/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JanelaPrincipal.java
 *
 * Created on 25/05/2011, 13:43:11
 */

package InterfaceEI;

import Calculos.CalculaConcentrada;
import Calculos.CalculaDistribuida;
import Calculos.CalcularDiagrama;
import Calculos.Graficos;
import CirculoMohr.CirculoDeMohr;
import Eventos.MouseEventosConcentrada;
import Eventos.MouseEventosDistribuida;
import Eventos.MouseEventosViga;
import Eventos.EventoTextsField;
import Eventos.MouseEventosMomento;
import Eventos.MouseEventosPanel;
import Integracao.ResultadoSeccao;
import InterfaceCirculoMohr.PanelCirculoMohr;
import InterfaceSeccao.Figura;
import Seccao.Calculo;
import Utils.Utilidades;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.Point;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.Border;
import javax.swing.text.MaskFormatter;
import org.jfree.chart.ChartPanel;

/**
 *
 * @author Isabela
 */
public class JanelaPrincipal extends javax.swing.JFrame {

    private MouseEventosViga mouseViga;
    private MouseEventosConcentrada mouseConcentrada;
    private MouseEventosDistribuida mouseDistribuida;
    private MouseEventosMomento mouseMomento;
    private CalcularDiagrama diagramas;//referência para o objeto que calcula os gráficos
    private ChartPanel graficosDiagramas[]=new ChartPanel[2];//vetor com os 2 gráficos dos diagramas de Momento fletor e esforço cortante


    private double tamanhoViga;//tamanho da viga em metros
    private double xViga;//inicio da viga em metros
    private double forcaC;//intensidade da carga concentrada em N
    private double forcaD;//intensidade da carga distribuida em N
    private double forcaM;//intensidade da carga concentrada em N
    private double xConcentrada;//localizacao da carga concentrada em metros
    private double xMomento;//localizacao da carga concentrada em metros
    private double xDistribuida;//localizacao da carga distribuida em metros
    private double tamanhoD;//tamanho da carga distribuida em metros

    //tipo de apoio
    private boolean fixoD = false;
    private boolean distF = false;
    private boolean pontoE = false;
    private boolean engstP = false;

    private Utilidades utili = new Utilidades();

    private DecimalFormat df = new DecimalFormat("0.00");

    private int i = 0;

    private Border bordaI;

    private EventoTextsField eventoTextTV = new EventoTextsField();

    private boolean enableCarga = false;

    private double momentoFletor[];
    private double esforcoCortante[];
    private double x[];

    private ArrayList<Point> pontosCortante = new ArrayList<Point>();
    private ArrayList<Point> pontosFletor = new ArrayList<Point>();

    private int indiceFletor;
    private int indiceCortante;

    //private JanelaInformacoes2 informacoes = new JanelaInformacoes2();

    //Integracao
    private boolean habilitouInfo = false;
    private boolean opcaoGrafico = true;//true = Esforcos Internos e false= Deformada
    private boolean opcaoValor = true;//true = Esforcos Internos e false= Deformada
    
    private double deformada[];
    private ArrayList<Point> pontosDeformada = new ArrayList<Point>();


    //------------Bit e Vei
    //Secao
    private Figura fig;
    private ResultadoSeccao resultSeccao;
    private int[] xs, ys;


    //------------Fab e Dede
    //Circulo de Mohr
    //private CirculoDeMohr circulo;
    private PanelCirculoMohr panelMohr;
    private double anguloMohr;

    /** Creates new form JanelaPrincipal */
    public JanelaPrincipal() {
          try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(JanelaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(JanelaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(JanelaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(JanelaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }

        initComponents();
        jCBTipoFigura.setSelectedIndex(-1);
        //informacoes.setVisible(true);

        this.buttonExecMohr.setEnabled(false);

     

        //jPCargas.setVisible(false);
        //jPInform.setVisible(false);

        bordaI = jTTamViga.getBorder();

        setVisibleInfoViga(false);
        setVisibleInfoConcentrada(false);
        setVisibleInfoDistribuida(false);
        setVisibleInfoMomento(false);

        setVisibleAnguloMohr(false);


        eventoTextTV.setFrame(this);

        jTTamViga.addFocusListener(eventoTextTV);
        jTXViga.addFocusListener(eventoTextTV);

        jTXConc.addFocusListener(eventoTextTV);
        jTForcaConc.addFocusListener(eventoTextTV);

        jTtamDist.addFocusListener(eventoTextTV);
        jTXDist.addFocusListener(eventoTextTV);
        jTForcaDist.addFocusListener(eventoTextTV);
        
        jTXMomento.addFocusListener(eventoTextTV);
        jTForcaMom.addFocusListener(eventoTextTV);
        
        MouseEventosPanel mousePanel = new MouseEventosPanel(panelPrincipal1, this);
        panelPrincipal1.addMouseListener(mousePanel);
        panelPrincipal1.addMouseMotionListener(mousePanel);

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabbedPrincipal = new javax.swing.JTabbedPane();
        panelEsforcos = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jTDesenhoViga = new javax.swing.JToggleButton();
        jPCargas = new javax.swing.JPanel();
        jRConcentrada = new javax.swing.JRadioButton();
        jRDistribuida = new javax.swing.JRadioButton();
        jRMomento = new javax.swing.JRadioButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        panelGrafico3 = new javax.swing.JTabbedPane();
        jPanel4 = new javax.swing.JPanel();
        panelGraficoMF = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        panelGraficoEC = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        panelGraficoD = new javax.swing.JPanel();
        jPExibirTela = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        exibeGraficoMF = new javax.swing.JCheckBox();
        exibeGraficoEC = new javax.swing.JCheckBox();
        exibeMomento = new javax.swing.JCheckBox();
        exibeEsforco = new javax.swing.JCheckBox();
        jPanel8 = new javax.swing.JPanel();
        graficoDeformada = new javax.swing.JCheckBox();
        exibeDeformada = new javax.swing.JCheckBox();
        jPanel9 = new javax.swing.JPanel();
        buttonSeccao = new javax.swing.JButton();
        buttonMohr = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        panelPrincipal1 = new InterfaceEI.PanelPrincipal();
        jToolBar1 = new javax.swing.JToolBar();
        jLabel22 = new javax.swing.JLabel();
        textFieldXpixel = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        textFieldYpixel = new javax.swing.JTextField();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        jLabel24 = new javax.swing.JLabel();
        textFieldXreal = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        textFieldYreal = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        jPInform = new javax.swing.JPanel();
        jPIViga = new javax.swing.JPanel();
        labelTViga = new javax.swing.JLabel();
        jTTamViga = new javax.swing.JTextField();
        labelMTViga = new javax.swing.JLabel();
        labelXViga = new javax.swing.JLabel();
        jTXViga = new javax.swing.JTextField();
        labelMXViga = new javax.swing.JLabel();
        jPIConcentrada = new javax.swing.JPanel();
        labelXConc = new javax.swing.JLabel();
        jTXConc = new javax.swing.JTextField();
        labelMXConc = new javax.swing.JLabel();
        labelForcaConc = new javax.swing.JLabel();
        jTForcaConc = new javax.swing.JTextField();
        labelNConc = new javax.swing.JLabel();
        jPIDistribuida = new javax.swing.JPanel();
        labelTDist = new javax.swing.JLabel();
        jTtamDist = new javax.swing.JTextField();
        labelMTDist = new javax.swing.JLabel();
        labelXDist = new javax.swing.JLabel();
        jTXDist = new javax.swing.JTextField();
        labelMXDist = new javax.swing.JLabel();
        labelForcaDist = new javax.swing.JLabel();
        jTForcaDist = new javax.swing.JTextField();
        labelNDist = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        labelXMom = new javax.swing.JLabel();
        jTXMomento = new javax.swing.JTextField();
        labelMXMom = new javax.swing.JLabel();
        labelForcaMom = new javax.swing.JLabel();
        jTForcaMom = new javax.swing.JTextField();
        labelNMom = new javax.swing.JLabel();
        panelSeccao = new javax.swing.JPanel();
        mainPanel = new javax.swing.JPanel();
        jCBTipoFigura = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        inXX = new javax.swing.JTextField();
        inYY = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        inBase = new javax.swing.JTextField();
        inRaio = new javax.swing.JTextField();
        inAltura = new javax.swing.JTextField();
        btInserir = new javax.swing.JButton();
        jLabel12 = new javax.swing.JLabel();
        jPanelFigura = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        jCBListaPontos = new javax.swing.JComboBox();
        btExcluir = new javax.swing.JButton();
        zoom = new javax.swing.JSlider();
        btLimpar = new javax.swing.JButton();
        btCalcular = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();
        inArea = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        inIx = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        inIy = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        inIxy = new javax.swing.JTextField();
        btPlotar = new javax.swing.JButton();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        panelCirculo = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jTextFieldAnguloMohr = new javax.swing.JTextField();
        buttonExecMohr = new javax.swing.JButton();
        jLabelResultadosMohr = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextAreaResultadosMohr = new javax.swing.JTextArea();
        jPanelMohr = new InterfaceCirculoMohr.PanelCirculoMohr2();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        panelEsforcos.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Apoio+Viga", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        jTDesenhoViga.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/biApoiadaBotao.png"))); // NOI18N
        jTDesenhoViga.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTDesenhoVigaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(jTDesenhoViga, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(21, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jTDesenhoViga, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE)
                .addContainerGap())
        );

        panelEsforcos.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, 180, 100));

        jPCargas.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Cargas", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        jRConcentrada.setEnabled(false);
        jRConcentrada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRConcentradaActionPerformed(evt);
            }
        });

        jRDistribuida.setEnabled(false);
        jRDistribuida.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRDistribuidaActionPerformed(evt);
            }
        });

        jRMomento.setEnabled(false);
        jRMomento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRMomentoActionPerformed(evt);
            }
        });

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/momentoNovo.png"))); // NOI18N

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/cargaConcentrada.png"))); // NOI18N

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/cargaDistribuida.png"))); // NOI18N

        javax.swing.GroupLayout jPCargasLayout = new javax.swing.GroupLayout(jPCargas);
        jPCargas.setLayout(jPCargasLayout);
        jPCargasLayout.setHorizontalGroup(
            jPCargasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPCargasLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPCargasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPCargasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jRDistribuida)
                        .addComponent(jRConcentrada))
                    .addComponent(jRMomento))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPCargasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addGroup(jPCargasLayout.createSequentialGroup()
                        .addGap(4, 4, 4)
                        .addComponent(jLabel3))
                    .addComponent(jLabel1))
                .addGap(78, 78, 78))
        );
        jPCargasLayout.setVerticalGroup(
            jPCargasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPCargasLayout.createSequentialGroup()
                .addGroup(jPCargasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jRConcentrada))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPCargasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jRDistribuida)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPCargasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1)
                    .addComponent(jRMomento))
                .addContainerGap())
        );

        panelEsforcos.add(jPCargas, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 100, 180, 130));

        panelGraficoMF.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        panelGraficoMF.setLayout(new java.awt.GridLayout(1, 0));

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelGraficoMF, javax.swing.GroupLayout.DEFAULT_SIZE, 545, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelGraficoMF, javax.swing.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
                .addContainerGap())
        );

        panelGrafico3.addTab("Momento Fletor", jPanel4);

        panelGraficoEC.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        panelGraficoEC.setLayout(new java.awt.GridLayout(1, 0));

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelGraficoEC, javax.swing.GroupLayout.DEFAULT_SIZE, 545, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelGraficoEC, javax.swing.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
                .addContainerGap())
        );

        panelGrafico3.addTab("Esforço Cortante", jPanel5);

        panelGraficoD.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        panelGraficoD.setLayout(new java.awt.GridLayout(1, 0));

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelGraficoD, javax.swing.GroupLayout.DEFAULT_SIZE, 545, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelGraficoD, javax.swing.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
                .addContainerGap())
        );

        panelGrafico3.addTab("Deformação", jPanel6);

        panelEsforcos.add(panelGrafico3, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 380, 570, 260));

        jPExibirTela.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Exibir na Tela", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Esforços Internos"));

        exibeGraficoMF.setSelected(true);
        exibeGraficoMF.setText("Gráfico MF");
        exibeGraficoMF.setEnabled(false);
        exibeGraficoMF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exibeGraficoMFActionPerformed(evt);
            }
        });

        exibeGraficoEC.setSelected(true);
        exibeGraficoEC.setText("Gráfico EC");
        exibeGraficoEC.setEnabled(false);
        exibeGraficoEC.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exibeGraficoECActionPerformed(evt);
            }
        });

        exibeMomento.setSelected(true);
        exibeMomento.setText("Momento F.");
        exibeMomento.setEnabled(false);
        exibeMomento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exibeMomentoActionPerformed(evt);
            }
        });

        exibeEsforco.setSelected(true);
        exibeEsforco.setText("Esforço C.");
        exibeEsforco.setEnabled(false);
        exibeEsforco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exibeEsforcoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(exibeGraficoMF)
                    .addComponent(exibeGraficoEC)
                    .addComponent(exibeMomento)
                    .addComponent(exibeEsforco))
                .addContainerGap(17, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(exibeGraficoMF)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(exibeGraficoEC)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(exibeMomento)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(exibeEsforco)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Deformação"));

        graficoDeformada.setText("Gráfico Def");
        graficoDeformada.setEnabled(false);
        graficoDeformada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                graficoDeformadaActionPerformed(evt);
            }
        });

        exibeDeformada.setText("Deformada");
        exibeDeformada.setEnabled(false);
        exibeDeformada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exibeDeformadaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(graficoDeformada)
                    .addComponent(exibeDeformada))
                .addContainerGap(21, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addComponent(graficoDeformada)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(exibeDeformada)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPExibirTelaLayout = new javax.swing.GroupLayout(jPExibirTela);
        jPExibirTela.setLayout(jPExibirTelaLayout);
        jPExibirTelaLayout.setHorizontalGroup(
            jPExibirTelaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPExibirTelaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPExibirTelaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(32, Short.MAX_VALUE))
        );
        jPExibirTelaLayout.setVerticalGroup(
            jPExibirTelaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPExibirTelaLayout.createSequentialGroup()
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(4, 4, 4)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(40, Short.MAX_VALUE))
        );

        panelEsforcos.add(jPExibirTela, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 340, 180, 300));

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Cálculos"));

        buttonSeccao.setText("Secção");
        buttonSeccao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSeccaoActionPerformed(evt);
            }
        });

        buttonMohr.setText("Círculo de Mohr");
        buttonMohr.setEnabled(false);
        buttonMohr.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonMohrActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(buttonMohr, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)
                    .addComponent(buttonSeccao, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE))
                .addGap(23, 23, 23))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addComponent(buttonSeccao)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(buttonMohr)
                .addContainerGap(23, Short.MAX_VALUE))
        );

        panelEsforcos.add(jPanel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 230, 180, 110));

        jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane3.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        panelPrincipal1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout panelPrincipal1Layout = new javax.swing.GroupLayout(panelPrincipal1);
        panelPrincipal1.setLayout(panelPrincipal1Layout);
        panelPrincipal1Layout.setHorizontalGroup(
            panelPrincipal1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 892, Short.MAX_VALUE)
        );
        panelPrincipal1Layout.setVerticalGroup(
            panelPrincipal1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 413, Short.MAX_VALUE)
        );

        jScrollPane3.setViewportView(panelPrincipal1);

        panelEsforcos.add(jScrollPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 10, 570, 320));

        jToolBar1.setRollover(true);

        jLabel22.setText("xPixel:");
        jToolBar1.add(jLabel22);

        textFieldXpixel.setEditable(false);
        textFieldXpixel.setText("            ");
        jToolBar1.add(textFieldXpixel);

        jLabel23.setText("     yPixel:");
        jToolBar1.add(jLabel23);

        textFieldYpixel.setEditable(false);
        textFieldYpixel.setText("            ");
        jToolBar1.add(textFieldYpixel);
        jToolBar1.add(jSeparator1);

        jLabel24.setText("xReal:");
        jToolBar1.add(jLabel24);

        textFieldXreal.setEditable(false);
        textFieldXreal.setText("            ");
        jToolBar1.add(textFieldXreal);

        jLabel26.setText("   m");
        jToolBar1.add(jLabel26);

        jLabel25.setText("     yReal:");
        jToolBar1.add(jLabel25);

        textFieldYreal.setEditable(false);
        textFieldYreal.setText("            ");
        jToolBar1.add(textFieldYreal);

        jLabel27.setText("   m");
        jToolBar1.add(jLabel27);

        panelEsforcos.add(jToolBar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 340, 570, 30));

        jPInform.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Informações", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        jPIViga.setBorder(javax.swing.BorderFactory.createTitledBorder("Viga"));
        jPIViga.setEnabled(false);

        labelTViga.setText("Tamanho:");
        labelTViga.setEnabled(false);

        jTTamViga.setEditable(false);
        jTTamViga.setEnabled(false);
        jTTamViga.setMaximumSize(new java.awt.Dimension(6, 20));
        jTTamViga.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTTamVigaActionPerformed(evt);
            }
        });

        labelMTViga.setText("m");
        labelMTViga.setEnabled(false);

        labelXViga.setText("Posição:");
        labelXViga.setEnabled(false);

        jTXViga.setEditable(false);
        jTXViga.setEnabled(false);
        jTXViga.setMaximumSize(new java.awt.Dimension(6, 20));
        jTXViga.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTXVigajTXVigaActionPerformed(evt);
            }
        });

        labelMXViga.setText("m");
        labelMXViga.setEnabled(false);

        javax.swing.GroupLayout jPIVigaLayout = new javax.swing.GroupLayout(jPIViga);
        jPIViga.setLayout(jPIVigaLayout);
        jPIVigaLayout.setHorizontalGroup(
            jPIVigaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPIVigaLayout.createSequentialGroup()
                .addGroup(jPIVigaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelXViga)
                    .addComponent(labelTViga))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPIVigaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTXViga, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jTTamViga, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPIVigaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelMTViga)
                    .addComponent(labelMXViga))
                .addContainerGap(16, Short.MAX_VALUE))
        );
        jPIVigaLayout.setVerticalGroup(
            jPIVigaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPIVigaLayout.createSequentialGroup()
                .addGroup(jPIVigaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelTViga)
                    .addComponent(jTTamViga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelMTViga))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPIVigaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPIVigaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTXViga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelMXViga))
                    .addComponent(labelXViga))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPIConcentrada.setBorder(javax.swing.BorderFactory.createTitledBorder("Carga Concentrada"));

        labelXConc.setText("Posição:");

        jTXConc.setMaximumSize(new java.awt.Dimension(6, 20));
        jTXConc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTXConcActionPerformed(evt);
            }
        });

        labelMXConc.setText("m");

        labelForcaConc.setText("F:");

        jTForcaConc.setMaximumSize(new java.awt.Dimension(6, 20));
        jTForcaConc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTForcaConcActionPerformed(evt);
            }
        });

        labelNConc.setText("N");

        javax.swing.GroupLayout jPIConcentradaLayout = new javax.swing.GroupLayout(jPIConcentrada);
        jPIConcentrada.setLayout(jPIConcentradaLayout);
        jPIConcentradaLayout.setHorizontalGroup(
            jPIConcentradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPIConcentradaLayout.createSequentialGroup()
                .addGroup(jPIConcentradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPIConcentradaLayout.createSequentialGroup()
                        .addComponent(labelXConc)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTXConc, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPIConcentradaLayout.createSequentialGroup()
                        .addComponent(labelForcaConc)
                        .addGap(2, 2, 2)
                        .addComponent(jTForcaConc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPIConcentradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelMXConc)
                    .addComponent(labelNConc))
                .addContainerGap(18, Short.MAX_VALUE))
        );
        jPIConcentradaLayout.setVerticalGroup(
            jPIConcentradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPIConcentradaLayout.createSequentialGroup()
                .addGroup(jPIConcentradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPIConcentradaLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(labelXConc))
                    .addGroup(jPIConcentradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTXConc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelMXConc)))
                .addGroup(jPIConcentradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPIConcentradaLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(labelForcaConc))
                    .addGroup(jPIConcentradaLayout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addGroup(jPIConcentradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTForcaConc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelNConc))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPIDistribuida.setBorder(javax.swing.BorderFactory.createTitledBorder("Carga Distribuida"));

        labelTDist.setText("Tamanho:");

        jTtamDist.setMaximumSize(new java.awt.Dimension(6, 20));
        jTtamDist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTtamDistActionPerformed(evt);
            }
        });

        labelMTDist.setText("m");

        labelXDist.setText("Posição:");

        jTXDist.setMaximumSize(new java.awt.Dimension(6, 20));
        jTXDist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTXDistActionPerformed(evt);
            }
        });

        labelMXDist.setText("m");

        labelForcaDist.setText("F:");

        jTForcaDist.setMaximumSize(new java.awt.Dimension(6, 20));
        jTForcaDist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTForcaDistActionPerformed(evt);
            }
        });

        labelNDist.setText("N");

        javax.swing.GroupLayout jPIDistribuidaLayout = new javax.swing.GroupLayout(jPIDistribuida);
        jPIDistribuida.setLayout(jPIDistribuidaLayout);
        jPIDistribuidaLayout.setHorizontalGroup(
            jPIDistribuidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPIDistribuidaLayout.createSequentialGroup()
                .addGroup(jPIDistribuidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPIDistribuidaLayout.createSequentialGroup()
                        .addComponent(labelTDist)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTtamDist, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPIDistribuidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPIDistribuidaLayout.createSequentialGroup()
                            .addComponent(labelXDist)
                            .addGap(10, 10, 10)
                            .addComponent(jTXDist, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPIDistribuidaLayout.createSequentialGroup()
                            .addComponent(labelForcaDist)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jTForcaDist, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPIDistribuidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelMXDist)
                    .addComponent(labelMTDist)
                    .addComponent(labelNDist))
                .addContainerGap(20, Short.MAX_VALUE))
        );
        jPIDistribuidaLayout.setVerticalGroup(
            jPIDistribuidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPIDistribuidaLayout.createSequentialGroup()
                .addGroup(jPIDistribuidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPIDistribuidaLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(labelTDist))
                    .addGroup(jPIDistribuidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTtamDist, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelMTDist)))
                .addGroup(jPIDistribuidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPIDistribuidaLayout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(labelXDist))
                    .addGroup(jPIDistribuidaLayout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addGroup(jPIDistribuidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTXDist, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelMXDist))))
                .addGroup(jPIDistribuidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPIDistribuidaLayout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(labelForcaDist))
                    .addGroup(jPIDistribuidaLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPIDistribuidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTForcaDist, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelNDist))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Carga Momento"));

        labelXMom.setText("Posição:");

        jTXMomento.setMaximumSize(new java.awt.Dimension(6, 20));
        jTXMomento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTXMomentoActionPerformed(evt);
            }
        });

        labelMXMom.setText("m");

        labelForcaMom.setText("F:");

        jTForcaMom.setMaximumSize(new java.awt.Dimension(6, 20));
        jTForcaMom.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTForcaMomActionPerformed(evt);
            }
        });

        labelNMom.setText("N");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(labelXMom)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTXMomento, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(labelForcaMom)
                        .addGap(4, 4, 4)
                        .addComponent(jTForcaMom, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelMXMom)
                    .addComponent(labelNMom))
                .addGap(23, 23, 23))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(labelXMom))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTXMomento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelMXMom)))
                .addGap(11, 11, 11)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTForcaMom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelNMom))
                    .addComponent(labelForcaMom))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPInformLayout = new javax.swing.GroupLayout(jPInform);
        jPInform.setLayout(jPInformLayout);
        jPInformLayout.setHorizontalGroup(
            jPInformLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPInformLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPInformLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPIDistribuida, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPInformLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPIConcentrada, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPIViga, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap(39, Short.MAX_VALUE))
        );
        jPInformLayout.setVerticalGroup(
            jPInformLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPInformLayout.createSequentialGroup()
                .addComponent(jPIViga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(23, 23, 23)
                .addComponent(jPIConcentrada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(22, 22, 22)
                .addComponent(jPIDistribuida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(36, 36, 36)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        panelEsforcos.add(jPInform, new org.netbeans.lib.awtextra.AbsoluteConstraints(790, 0, 220, -1));

        tabbedPrincipal.addTab("Esforços Internos", panelEsforcos);

        mainPanel.setPreferredSize(new java.awt.Dimension(1225, 572));

        jCBTipoFigura.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Retângulo", "Triângulo", "Círculo", "Semicírculo", "1/4 Círculo", "Outro Polígono" }));
        jCBTipoFigura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCBTipoFiguraActionPerformed(evt);
            }
        });
        jCBTipoFigura.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jCBTipoFiguraFocusLost(evt);
            }
        });

        jLabel5.setText("Selecione a figura geométrica");

        jLabel6.setText("Base");

        jLabel7.setText("Altura");

        jLabel8.setText("Raio");

        jLabel9.setText("INSERIR PONTOS");

        jLabel10.setText("X");

        inXX.setToolTipText("Coordenada X do ponto a ser inserido");
        inXX.setEnabled(false);

        inYY.setToolTipText("Coordenada Y do ponto a ser inserido");
        inYY.setEnabled(false);

        jLabel11.setText("Y");

        inBase.setToolTipText("Base em metros");
        inBase.setEnabled(false);
        inBase.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                inBaseFocusGained(evt);
            }
        });

        inRaio.setToolTipText("Raio em Metros");
        inRaio.setEnabled(false);

        inAltura.setToolTipText("Altura em metros");
        inAltura.setEnabled(false);

        btInserir.setText("Inserir");
        btInserir.setToolTipText("Inserir Ponto na lista de Pontos");
        btInserir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btInserirActionPerformed(evt);
            }
        });

        jLabel12.setText("Figura");

        jPanelFigura.setBorder(javax.swing.BorderFactory.createTitledBorder("Area de Plotagem"));
        carregarFigura();

        javax.swing.GroupLayout jPanelFiguraLayout = new javax.swing.GroupLayout(jPanelFigura);
        jPanelFigura.setLayout(jPanelFiguraLayout);
        jPanelFiguraLayout.setHorizontalGroup(
            jPanelFiguraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 743, Short.MAX_VALUE)
        );
        jPanelFiguraLayout.setVerticalGroup(
            jPanelFiguraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 541, Short.MAX_VALUE)
        );

        jLabel13.setText("Lista de Pontos");

        jCBListaPontos.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "40;0", "80;0", "80;40", "40;40" }));
        jCBListaPontos.setToolTipText("Lista de Pontos");

        btExcluir.setText("Excluir Ponto");
        btExcluir.setToolTipText("Excluir Ponto Selecionado");
        btExcluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btExcluirActionPerformed(evt);
            }
        });

        zoom.setMaximum(400);
        zoom.setMinorTickSpacing(100);
        zoom.setPaintLabels(true);
        zoom.setPaintTicks(true);
        zoom.setToolTipText("Barra de ZOOM");
        zoom.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                zoomStateChanged(evt);
            }
        });

        btLimpar.setText("Limpar");
        btLimpar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btLimparActionPerformed(evt);
            }
        });

        btCalcular.setText("Calcular");
        btCalcular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCalcularActionPerformed(evt);
            }
        });

        jLabel14.setText("Area");

        inArea.setText("Area");
        inArea.setToolTipText("Area em M²");

        jLabel15.setText("Ix");

        inIx.setText("Inercia X");
        inIx.setToolTipText("Inercia em relação ao eixo X");

        jLabel16.setText("Iy");

        inIy.setText("Inercia Y");
        inIy.setToolTipText("Inercia em relação ao eixo Y");

        jLabel17.setText("Ixy");

        inIxy.setText("Produto de Inercia");
        inIxy.setToolTipText("Produto de Inercia");

        carregarFigura();
        btPlotar.setText("Plotar");
        btPlotar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btPlotarActionPerformed(evt);
            }
        });

        jLabel18.setText("m2");

        jLabel19.setText("m4");

        jLabel20.setText("m4");

        jLabel21.setText("m4");

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                .addComponent(jLabel17)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(inIxy))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                .addComponent(jLabel16)
                                .addGap(18, 18, 18)
                                .addComponent(inIy))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                .addComponent(jLabel15)
                                .addGap(18, 18, 18)
                                .addComponent(inIx))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                .addComponent(jLabel14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(inArea))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                .addComponent(btLimpar)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btCalcular)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel18)
                            .addComponent(jLabel19)
                            .addComponent(jLabel20)
                            .addComponent(jLabel21)
                            .addComponent(btPlotar)))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9)
                            .addComponent(jLabel13)
                            .addGroup(mainPanelLayout.createSequentialGroup()
                                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jCBListaPontos, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                        .addComponent(jLabel10)
                                        .addGap(10, 10, 10)
                                        .addComponent(inXX, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel11)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(inYY, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(btInserir)
                                    .addComponent(btExcluir)))
                            .addGroup(mainPanelLayout.createSequentialGroup()
                                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                        .addComponent(jLabel7)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(inAltura))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                        .addComponent(jLabel6)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(inBase, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel8)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(inRaio, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jCBTipoFigura, javax.swing.GroupLayout.PREFERRED_SIZE, 208, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(zoom, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 769, Short.MAX_VALUE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanelFigura, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(mainPanelLayout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addGap(212, 212, 212)))))
                .addContainerGap())
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel12))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(jCBTipoFigura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(inBase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE)
                            .addComponent(inRaio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(inAltura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(inXX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11)
                            .addComponent(inYY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btInserir))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jCBListaPontos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btExcluir))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btLimpar)
                            .addComponent(btCalcular)
                            .addComponent(btPlotar))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14)
                            .addComponent(inArea, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel18))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(inIx, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel20))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel16)
                            .addComponent(inIy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel21))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel17)
                            .addComponent(inIxy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel19)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
                        .addComponent(jPanelFigura, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(zoom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        javax.swing.GroupLayout panelSeccaoLayout = new javax.swing.GroupLayout(panelSeccao);
        panelSeccao.setLayout(panelSeccaoLayout);
        panelSeccaoLayout.setHorizontalGroup(
            panelSeccaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelSeccaoLayout.createSequentialGroup()
                .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 1015, Short.MAX_VALUE)
                .addContainerGap())
        );
        panelSeccaoLayout.setVerticalGroup(
            panelSeccaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)
        );

        tabbedPrincipal.addTab("Secção", panelSeccao);

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Parâmetros", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel10.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel4.setText("Angulo: ");
        jPanel10.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        jTextFieldAnguloMohr.setEnabled(false);
        jPanel10.add(jTextFieldAnguloMohr, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 20, 190, -1));

        buttonExecMohr.setText("Executar");
        buttonExecMohr.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonExecMohrActionPerformed(evt);
            }
        });
        jPanel10.add(buttonExecMohr, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 50, 107, -1));

        jLabelResultadosMohr.setText("Resultados");

        jTextAreaResultadosMohr.setColumns(20);
        jTextAreaResultadosMohr.setRows(5);
        jScrollPane2.setViewportView(jTextAreaResultadosMohr);

        jPanelMohr.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout jPanelMohrLayout = new javax.swing.GroupLayout(jPanelMohr);
        jPanelMohr.setLayout(jPanelMohrLayout);
        jPanelMohrLayout.setHorizontalGroup(
            jPanelMohrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 697, Short.MAX_VALUE)
        );
        jPanelMohrLayout.setVerticalGroup(
            jPanelMohrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 628, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout panelCirculoLayout = new javax.swing.GroupLayout(panelCirculo);
        panelCirculo.setLayout(panelCirculoLayout);
        panelCirculoLayout.setHorizontalGroup(
            panelCirculoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelCirculoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelCirculoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelResultadosMohr)
                    .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jPanelMohr, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        panelCirculoLayout.setVerticalGroup(
            panelCirculoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelCirculoLayout.createSequentialGroup()
                .addGroup(panelCirculoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelCirculoLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanelMohr, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(panelCirculoLayout.createSequentialGroup()
                        .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabelResultadosMohr)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 514, Short.MAX_VALUE)))
                .addContainerGap())
        );

        tabbedPrincipal.addTab("Circulo de Mohr", panelCirculo);

        getContentPane().add(tabbedPrincipal, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1030, 680));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void exibeEsforcoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exibeEsforcoActionPerformed
        if (!exibeEsforco.isSelected()) {
            panelPrincipal1.setEsforcoCortante(false);
            panelPrincipal1.setValorCortante(0);


            panelPrincipal1.repaint();
            panelPrincipal1.validate();
        }
        else {//selecionou
            opcaoValor = true;
            exibeDeformada.setSelected(false);

            panelPrincipal1.setDeformadaValor(false);
            panelPrincipal1.repaint();
            panelPrincipal1.validate();
        }
    }//GEN-LAST:event_exibeEsforcoActionPerformed

    private void graficoDeformadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_graficoDeformadaActionPerformed
        if(graficoDeformada.isSelected()){
            opcaoGrafico = false;
            exibeGraficoEC.setSelected(false);
            exibeGraficoMF.setSelected(false);

            panelPrincipal1.setGraficoCortante(false);
            panelPrincipal1.setGraficoFletor(false);
           
            //chama calculo e exibe
            calcula();
            converteGrafico();

            panelPrincipal1.setDeformada(pontosDeformada);
            panelPrincipal1.setGraficoDeformada(true);
            panelPrincipal1.repaint();
            panelPrincipal1.validate();

        }
        else{
            if (habilitouInfo) {
                //Habilita grafico esforcos
                exibeGraficoEC.setEnabled(true);
                exibeGraficoMF.setEnabled(true);
            }
            //exibeDeformacao.setEnabled(false);
            panelPrincipal1.setGraficoDeformada(false);
            panelPrincipal1.repaint();
            panelPrincipal1.validate();

            panelGraficoD.removeAll();
            panelGraficoD.repaint();
            panelGraficoD.validate();
        }
}//GEN-LAST:event_graficoDeformadaActionPerformed

    private void exibeMomentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exibeMomentoActionPerformed
        if(!exibeMomento.isSelected()){
            panelPrincipal1.setMomentoFletor(false);


            panelPrincipal1.repaint();
            panelPrincipal1.validate();

        }
        else {//selecionou
            opcaoValor = true;
            exibeDeformada.setSelected(false);

            panelPrincipal1.setDeformadaValor(false);
            panelPrincipal1.repaint();
            panelPrincipal1.validate();
        }
}//GEN-LAST:event_exibeMomentoActionPerformed

    private void exibeGraficoECActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exibeGraficoECActionPerformed
        if(exibeGraficoEC.isSelected()){
            panelPrincipal1.setGraficoCortante(true);

            panelPrincipal1.repaint();
            panelPrincipal1.validate();

            opcaoGrafico = true;
            graficoDeformada.setSelected(false);
            panelGraficoD.removeAll();
            panelGraficoD.repaint();
            panelGraficoD.validate();

            panelPrincipal1.setGraficoDeformada(false);
            panelPrincipal1.repaint();
            panelPrincipal1.validate();
        }
        else{
            panelPrincipal1.setGraficoCortante(false);

            panelPrincipal1.repaint();
            panelPrincipal1.validate();

            if(!exibeGraficoMF.isSelected()){
                //Habilita Deformacao
                if (resultSeccao != null) {
                    graficoDeformada.setEnabled(true);
                    exibeDeformada.setEnabled(true);
                }

                //Desabilita grafico esforcos
                //exibeGraficoEC.setEnabled(false);
                //exibeGraficoMF.setEnabled(false);
            }
        }
}//GEN-LAST:event_exibeGraficoECActionPerformed

    private void exibeGraficoMFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exibeGraficoMFActionPerformed
        if(exibeGraficoMF.isSelected()){
            panelPrincipal1.setGraficoFletor(true);
            panelPrincipal1.setValorMomento(0);

            panelPrincipal1.repaint();
            panelPrincipal1.validate();

            opcaoGrafico = true;
            graficoDeformada.setSelected(false);
            panelGraficoD.removeAll();
            panelGraficoD.repaint();
            panelGraficoD.validate();

            panelPrincipal1.setGraficoDeformada(false);
            panelPrincipal1.repaint();
            panelPrincipal1.validate();
        }
        else{
            panelPrincipal1.setGraficoFletor(false);

            panelPrincipal1.repaint();
            panelPrincipal1.validate();

            if(!exibeGraficoEC.isSelected()){
                if (resultSeccao != null) {
                    //Habilita Deformacao
                    graficoDeformada.setEnabled(true);
                    exibeDeformada.setEnabled(true);
                }

                //Desabilita grafico esforcos
                //exibeGraficoEC.setEnabled(false);
                //exibeGraficoMF.setEnabled(false);
            }
        }
}//GEN-LAST:event_exibeGraficoMFActionPerformed

    private void jRMomentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRMomentoActionPerformed
        jTDesenhoViga.setSelected(false);
        if(jRMomento.isSelected()){
            mouseMomento = new MouseEventosMomento(panelPrincipal1, this);
            mouseMomento.setPanelP(panelPrincipal1);
            mouseMomento.setFrame(this);


            //panelPrincipal1.removeMouseListener(mouseViga);
            //panelPrincipal1.removeMouseMotionListener(mouseViga);

            panelPrincipal1.removeMouseListener(mouseDistribuida);
            panelPrincipal1.removeMouseMotionListener(mouseDistribuida);

            panelPrincipal1.removeMouseListener(mouseConcentrada);
            panelPrincipal1.removeMouseMotionListener(mouseConcentrada);

            panelPrincipal1.addMouseListener(mouseMomento);
            panelPrincipal1.addMouseMotionListener(mouseMomento);

            panelPrincipal1.setcMomento(true);
            panelPrincipal1.setxMomento(panelPrincipal1.getxInicio());

            setVisibleExibirTela(true);
            habilitouInfo = true;


            panelPrincipal1.repaint();
            panelPrincipal1.validate();
            //jPIConcentrada.setVisible(true);
            setVisibleInfoMomento(true);

            enableCarga = true;

            if(!graficoDeformada.isSelected()){
                opcaoGrafico = true;
                
                exibeGraficoMF.setSelected(true);
                exibeGraficoEC.setSelected(true);
                
                exibeEsforco.setSelected(true);
                exibeMomento.setSelected(true);
            }
            else{
                exibeGraficoMF.setSelected(false);
                exibeGraficoEC.setSelected(false);
                
                exibeEsforco.setSelected(false);
                exibeMomento.setSelected(false);
            }
            
            if(exibeDeformada.isSelected()){               
                exibeEsforco.setSelected(false);
                exibeMomento.setSelected(false);
            }
            else{
                opcaoGrafico = true;
                
                exibeGraficoMF.setSelected(true);
                exibeGraficoEC.setSelected(true);
                
                exibeEsforco.setSelected(true);
                exibeMomento.setSelected(true);
            }

        } else{
            panelPrincipal1.removeMouseListener(mouseMomento);
            panelPrincipal1.removeMouseMotionListener(mouseMomento);

            panelPrincipal1.setcMomento(false);
            panelPrincipal1.setDesenhouCM(false);

            setVisibleInfoMomento(false);

            panelPrincipal1.repaint();
            panelPrincipal1.validate();

            if(!jRConcentrada.isSelected() && !jRDistribuida.isSelected()){
                enableCarga = false;


                panelPrincipal1.setGraficoCortante(false);
                panelPrincipal1.setGraficoFletor(false);
                panelPrincipal1.setGraficoDeformada(false);

                panelPrincipal1.setReacaoBiapoiadaA(false);
                panelPrincipal1.setReacaoBiapoiadaB(false);

                panelPrincipal1.repaint();
                panelPrincipal1.validate();

            } else{
                calcula();
                converteGrafico();

                if (exibeGraficoMF.isSelected()) {

                    panelPrincipal1.setFletor(pontosFletor);

                    panelPrincipal1.setGraficoFletor(true);

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }
                if (exibeGraficoEC.isSelected()) {

                    panelPrincipal1.setCortante(pontosCortante);

                    panelPrincipal1.setGraficoCortante(true);

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }

                if (panelPrincipal1.getFixoD() || panelPrincipal1.getDesliF()) {
                    panelPrincipal1.setReacaoBiapoiadaA(true);
                    panelPrincipal1.setReacaoBiapoiadaB(true);

                    panelPrincipal1.setBiapoiadaA(diagramas.getReacaoBiemA());
                    panelPrincipal1.setBiapoiadaB(diagramas.getReacaoBiemB());
                } else {
                    panelPrincipal1.setReacaoBiapoiadaA(false);
                    panelPrincipal1.setReacaoBiapoiadaB(false);

                    panelPrincipal1.setReacaoEngastada(true);
                    panelPrincipal1.setValorReacaoE(diagramas.getReacaoApoioEngastado());
                }
            }
            //jPIConcentrada.setVisible(false);
        }
        //atribuindo o valor do tamanho da viga
        setTamViga();
        setjTTamViga();

        setTipoViga();//atribuindo qual foi o tipo de viga escolhida

        setInicioViga();
        setTextXViga();
}//GEN-LAST:event_jRMomentoActionPerformed

    private void jRDistribuidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRDistribuidaActionPerformed
        jTDesenhoViga.setSelected(false);
        if(jRDistribuida.isSelected()){

            mouseDistribuida = new MouseEventosDistribuida(panelPrincipal1, this);
            mouseDistribuida.setPanelP(panelPrincipal1);
            mouseDistribuida.setFrame(this);

            //panelPrincipal1.removeMouseListener(mouseViga);
            //panelPrincipal1.removeMouseMotionListener(mouseViga);

            panelPrincipal1.removeMouseListener(mouseMomento);
            panelPrincipal1.removeMouseMotionListener(mouseMomento);

            panelPrincipal1.removeMouseListener(mouseConcentrada);
            panelPrincipal1.removeMouseMotionListener(mouseConcentrada);

            panelPrincipal1.addMouseListener(mouseDistribuida);
            panelPrincipal1.addMouseMotionListener(mouseDistribuida);

            panelPrincipal1.setDistribuida(true);
            panelPrincipal1.setxInicioDist(panelPrincipal1.getxInicio());

            setVisibleExibirTela(true);
            habilitouInfo = true;

            setVisibleInfoDistribuida(true);


            panelPrincipal1.repaint();
            panelPrincipal1.validate();
            jPIDistribuida.setVisible(true);
            jPExibirTela.setVisible(true);

            enableCarga = true;

           if(!graficoDeformada.isSelected()){
                opcaoGrafico = true;
                
                exibeGraficoMF.setSelected(true);
                exibeGraficoEC.setSelected(true);
                
                exibeEsforco.setSelected(true);
                exibeMomento.setSelected(true);
            }
            else{
                exibeGraficoMF.setSelected(false);
                exibeGraficoEC.setSelected(false);
                
                exibeEsforco.setSelected(false);
                exibeMomento.setSelected(false);
            }
            
            if(exibeDeformada.isSelected()){               
                exibeEsforco.setSelected(false);
                exibeMomento.setSelected(false);
            }
            else{
                opcaoGrafico = true;
                
                exibeGraficoMF.setSelected(true);
                exibeGraficoEC.setSelected(true);
                
                exibeEsforco.setSelected(true);
                exibeMomento.setSelected(true);
            }
        } else{
            panelPrincipal1.removeMouseListener(mouseDistribuida);
            panelPrincipal1.removeMouseMotionListener(mouseDistribuida);

            panelPrincipal1.setDistribuida(false);
            panelPrincipal1.setDesenhouD(false);
            panelPrincipal1.setxFimDist(0);

            panelPrincipal1.repaint();
            panelPrincipal1.validate();

            if(!jRConcentrada.isSelected() && !jRMomento.isSelected()){
                enableCarga = false;

                panelPrincipal1.setGraficoCortante(false);
                panelPrincipal1.setGraficoFletor(false);
                panelPrincipal1.setGraficoDeformada(false);

                panelPrincipal1.setReacaoBiapoiadaA(false);
                panelPrincipal1.setReacaoBiapoiadaB(false);

                panelPrincipal1.repaint();
                panelPrincipal1.validate();
            } else{
                calcula();
                converteGrafico();

                if (exibeGraficoMF.isSelected()) {

                    panelPrincipal1.setFletor(pontosFletor);

                    panelPrincipal1.setGraficoFletor(true);

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }
                if (exibeGraficoEC.isSelected()) {

                    panelPrincipal1.setCortante(pontosCortante);

                    panelPrincipal1.setGraficoCortante(true);

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }

                if (panelPrincipal1.getFixoD() || panelPrincipal1.getDesliF()) {
                    panelPrincipal1.setReacaoBiapoiadaA(true);
                    panelPrincipal1.setReacaoBiapoiadaB(true);
                    panelPrincipal1.setBiapoiadaA(diagramas.getReacaoBiemA());
                    panelPrincipal1.setBiapoiadaB(diagramas.getReacaoBiemB());
                } else {
                    panelPrincipal1.setReacaoBiapoiadaA(false);
                    panelPrincipal1.setReacaoBiapoiadaB(false);

                    panelPrincipal1.setReacaoEngastada(true);
                    panelPrincipal1.setValorReacaoE(diagramas.getReacaoApoioEngastado());
                }
            }

            setVisibleInfoDistribuida(false);
        }
        //atribuindo o valor do tamanho da viga
        setTamViga();
        setjTTamViga();

        setInicioViga();
        setTextXViga();

        setTipoViga();//atribuindo qual foi o tipo de viga escolhida
    }//GEN-LAST:event_jRDistribuidaActionPerformed

    private void jRConcentradaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRConcentradaActionPerformed
        jTDesenhoViga.setSelected(false);
        if(jRConcentrada.isSelected()){
            mouseConcentrada = new MouseEventosConcentrada(panelPrincipal1, this);
            mouseConcentrada.setPanelP(panelPrincipal1);
            mouseConcentrada.setFrame(this);

            //panelPrincipal1.removeMouseListener(mouseViga);
            //panelPrincipal1.removeMouseMotionListener(mouseViga);

            panelPrincipal1.removeMouseListener(mouseDistribuida);
            panelPrincipal1.removeMouseMotionListener(mouseDistribuida);

            panelPrincipal1.removeMouseListener(mouseMomento);
            panelPrincipal1.removeMouseMotionListener(mouseMomento);

            panelPrincipal1.addMouseListener(mouseConcentrada);
            panelPrincipal1.addMouseMotionListener(mouseConcentrada);

            panelPrincipal1.setConcentrada(true);
            panelPrincipal1.setxConcentrada(panelPrincipal1.getxInicio());

            setVisibleExibirTela(true);
            habilitouInfo = true;


            panelPrincipal1.repaint();
            panelPrincipal1.validate();

            jPIConcentrada.setVisible(true);
            jPExibirTela.setVisible(true);

            setVisibleInfoConcentrada(true);

            enableCarga = true;

            if(!graficoDeformada.isSelected()){
                opcaoGrafico = true;
                
                exibeGraficoMF.setSelected(true);
                exibeGraficoEC.setSelected(true);
                
                exibeEsforco.setSelected(true);
                exibeMomento.setSelected(true);
            }
            else{
                exibeGraficoMF.setSelected(false);
                exibeGraficoEC.setSelected(false);
                
                exibeEsforco.setSelected(false);
                exibeMomento.setSelected(false);
            }
            
            if(exibeDeformada.isSelected()){               
                exibeEsforco.setSelected(false);
                exibeMomento.setSelected(false);
            }
            else{
                opcaoGrafico = true;
                
                exibeGraficoMF.setSelected(true);
                exibeGraficoEC.setSelected(true);
                
                exibeEsforco.setSelected(true);
                exibeMomento.setSelected(true);
            }
            
        } else{
            panelPrincipal1.removeMouseListener(mouseConcentrada);
            panelPrincipal1.removeMouseMotionListener(mouseConcentrada);

            panelPrincipal1.setConcentrada(false);

            panelPrincipal1.repaint();
            panelPrincipal1.validate();

            if(!jRDistribuida.isSelected() && !jRMomento.isSelected()){
                enableCarga = false;

                panelPrincipal1.setGraficoCortante(false);
                panelPrincipal1.setGraficoFletor(false);
                panelPrincipal1.setGraficoDeformada(false);

                panelPrincipal1.setReacaoBiapoiadaA(false);
                panelPrincipal1.setReacaoBiapoiadaB(false);

                panelPrincipal1.repaint();
                panelPrincipal1.validate();
            } else{
                calcula();
                converteGrafico();

                if (exibeGraficoMF.isSelected()) {

                    panelPrincipal1.setFletor(pontosFletor);

                    panelPrincipal1.setGraficoFletor(true);

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }
                if (exibeGraficoEC.isSelected()) {

                    panelPrincipal1.setCortante(pontosCortante);

                    panelPrincipal1.setGraficoCortante(true);

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }

                if (panelPrincipal1.getFixoD() || panelPrincipal1.getDesliF()) {
                    panelPrincipal1.setReacaoBiapoiadaA(true);
                    panelPrincipal1.setReacaoBiapoiadaB(true);
                    panelPrincipal1.setBiapoiadaA(diagramas.getReacaoBiemA());
                    panelPrincipal1.setBiapoiadaB(diagramas.getReacaoBiemB());
                } else {
                    panelPrincipal1.setReacaoBiapoiadaA(false);
                    panelPrincipal1.setReacaoBiapoiadaB(false);

                    panelPrincipal1.setReacaoEngastada(true);
                    panelPrincipal1.setValorReacaoE(diagramas.getReacaoApoioEngastado());
                }
            }

            setVisibleInfoConcentrada(false);

        }
        //atribuindo o valor do tamanho da viga
        setTamViga();
        setjTTamViga();

        setTipoViga();//atribuindo qual foi o tipo de viga escolhida

        setInicioViga();
        setTextXViga();
    }//GEN-LAST:event_jRConcentradaActionPerformed

    private void jTDesenhoVigaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTDesenhoVigaActionPerformed
        if (jTDesenhoViga.isSelected()) {
            panelPrincipal1.setConcentrada(false);
            panelPrincipal1.setDistribuida(false);
            panelPrincipal1.setDesenhouViga(false);
            panelPrincipal1.setDesliF(false);
            panelPrincipal1.setDesenhouC(false);
            panelPrincipal1.setDesenhouD(false);
            panelPrincipal1.setInicioViga(false);
            panelPrincipal1.setMomentoFletor(false);
            panelPrincipal1.setEsforcoCortante(false);
            panelPrincipal1.setPontoE(false);

            panelPrincipal1.removeMouseListener(mouseConcentrada);
            panelPrincipal1.removeMouseMotionListener(mouseConcentrada);
            panelPrincipal1.removeMouseListener(mouseDistribuida);
            panelPrincipal1.removeMouseMotionListener(mouseDistribuida);

            jRConcentrada.setEnabled(true);
            jRDistribuida.setEnabled(true);
            jRMomento.setEnabled(true);

            jRConcentrada.setSelected(false);
            jRDistribuida.setSelected(false);
            jRMomento.setSelected(false);

            setVisibleInfoViga(true);

            setVisibleInfoConcentrada(false);
            setVisibleInfoDistribuida(false);
            setVisibleInfoMomento(false);
            setVisibleExibirTela(false);
            habilitouInfo = false;
            setVisibleInfoViga(true);


            Point local = jTDesenhoViga.getLocationOnScreen();
            BotoesApoios bApoios = new BotoesApoios(this, false, jTDesenhoViga, panelPrincipal1);
            local.setLocation(local.x + jTDesenhoViga.getWidth(), local.y);
            bApoios.setLocation(local);
            bApoios.setVisible(true);
            mouseViga = new MouseEventosViga(panelPrincipal1, this);
            mouseViga.setPanelP(panelPrincipal1);
            panelPrincipal1.setDesenhouViga(false);
            panelPrincipal1.addMouseMotionListener(mouseViga);
            panelPrincipal1.addMouseListener(mouseViga);

            //            JanelaInformacoes informacoes = new JanelaInformacoes(this, false, jTDesenhoViga, panelPrincipal1);
            //            informacoes.setVisible(true);



            panelPrincipal1.setDistribuida(false);
            panelPrincipal1.setDesenhouD(false);
            panelPrincipal1.setxFimDist(0);

            panelPrincipal1.setcMomento(false);
            panelPrincipal1.setDesenhouCM(false);
            panelPrincipal1.setxCMomento(0);

            panelPrincipal1.setGraficoCortante(false);
            panelPrincipal1.setGraficoFletor(false);
            panelPrincipal1.setGraficoDeformada(false);

            panelPrincipal1.setReacaoBiapoiadaA(false);
            panelPrincipal1.setReacaoBiapoiadaB(false);
            panelPrincipal1.setReacaoEngastada(false);
            


            jPCargas.setVisible(true);
            jPInform.setVisible(true);
            jPIViga.setVisible(true);


            if(enableCarga){
                calcula();
                converteGrafico();

                if (exibeGraficoMF.isSelected()) {

                    panelPrincipal1.setFletor(pontosFletor);

                    panelPrincipal1.setGraficoFletor(true);

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }
                if (exibeGraficoEC.isSelected()) {

                    panelPrincipal1.setCortante(pontosCortante);

                    panelPrincipal1.setGraficoCortante(true);

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }
                enableCarga = false;
            }

        } else{
            panelPrincipal1.removeMouseListener(mouseViga);
            panelPrincipal1.removeMouseMotionListener(mouseViga);
            panelPrincipal1.setInicioViga(false);
            panelPrincipal1.setxFim(0);
        }
        //atribuindo o valor do tamanho da viga
        setTamViga();
        setjTTamViga();

        setInicioViga();
        setTextXViga();

        setTipoViga();//atribuindo qual foi o tipo de viga escolhida
    }//GEN-LAST:event_jTDesenhoVigaActionPerformed

    private void buttonExecMohrActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecMohrActionPerformed
        Double anguloMohr;

        //Verifica se existe algo escrito no campo de texto
        if(!this.jTextFieldAnguloMohr.getText().equals("")){
            anguloMohr = Double.valueOf(this.jTextFieldAnguloMohr.getText());
        }
        else{
            anguloMohr = 0.0;
        }


//        //Cria o circulo de Mohr
        CirculoDeMohr circulo = new CirculoDeMohr(resultSeccao.getiX(), resultSeccao.getiY(),resultSeccao.getpXY(), anguloMohr);

        //Adiciona o Circulo a Interface
        PanelCirculoMohr panelMohr = new PanelCirculoMohr(circulo);
        //this.jPanelMohr.removeAll();
        this.jPanelMohr.setLayout(new BorderLayout());
        this.jPanelMohr.add(panelMohr, BorderLayout.CENTER);
        jPanelMohr.validate();
        panelMohr.repaint();
        
        //this.jPanelMohr.setCirculo(circulo);

        //this.jPanelMohr.repaint();
        //this.jPanelMohr.validate();
        

        //Imprime os Resultados na área de Texto
        this.jTextAreaResultadosMohr.setText("");
        this.jTextAreaResultadosMohr.append(
                "Resultados:"+
                "\n----------------------------------" +
                "\nImin = " + new BigDecimal(circulo.getInerciaMinima()).setScale(5, BigDecimal.ROUND_HALF_UP) +
                "\nImed = " + new BigDecimal(circulo.getInerciaMedia()).setScale(5, BigDecimal.ROUND_HALF_UP) +
                "\nImax = " + new BigDecimal(circulo.getInerciaMaxima()).setScale(5, BigDecimal.ROUND_HALF_UP) +
                "\nRaio = " + new BigDecimal(circulo.getRaio()).setScale(5, BigDecimal.ROUND_HALF_UP) +
                "\nAngulo = " + new BigDecimal(circulo.getAnguloGraus()).setScale(5, BigDecimal.ROUND_HALF_UP) +
                "\n----------------------------------" +
                "\nIu = " + new BigDecimal(circulo.getiXLinha()).setScale(5, BigDecimal.ROUND_HALF_UP) +
                "\nIv = " + new BigDecimal(circulo.getiYLinha()).setScale(5, BigDecimal.ROUND_HALF_UP) +
                "\nPuv = " + new BigDecimal(circulo.getpXYLinha()).setScale(5, BigDecimal.ROUND_HALF_UP) +
                "\nAngulo do Eixo = " + new BigDecimal(circulo.getAnguloEixoGraus()).setScale(5, BigDecimal.ROUND_HALF_UP) +
                "\n----------------------------------"
                );
        this.jTextAreaResultadosMohr.setEditable(false);

    }//GEN-LAST:event_buttonExecMohrActionPerformed

    private void buttonMohrActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMohrActionPerformed
        tabbedPrincipal.setSelectedIndex(2);
        

    }//GEN-LAST:event_buttonMohrActionPerformed

    private void buttonSeccaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSeccaoActionPerformed
        tabbedPrincipal.setSelectedIndex(1);
        // aki colocar o metodo relacionado a seccao
        //no final instaciar a variavel "resultSeccao" e passar os valores de Ix,Iy,Ixy

        //para teste
//        resultSeccao = new ResultadoSeccao(12.4,3.4,22.3);
//        if(resultSeccao != null){
//            //Habilita Circulo de Mohr
//            buttonMohr.setEnabled(true);
//            setVisibleAnguloMohr(true);
//
//            //Habilita Deformada
//            if(enableCarga){
//                graficoDeformada.setEnabled(true);
//                exibeDeformada.setEnabled(true);
//            }
//        }
    }//GEN-LAST:event_buttonSeccaoActionPerformed

    private void jCBTipoFiguraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBTipoFiguraActionPerformed
        // TODO
        String opcao = String.valueOf(jCBTipoFigura.getSelectedItem());
        if (opcao.equals("Retângulo")) {
            inBase.setBackground(Color.white);
            inBase.setEnabled(true);

            inAltura.setBackground(Color.white);
            inAltura.setEnabled(true);

            inRaio.setEnabled(false);
            inRaio.setBackground(Color.white);

    
            inXX.setEnabled(false);
            inYY.setEnabled(false);
            btInserir.setEnabled(false);
            btExcluir.setEnabled(false);
            jCBListaPontos.setEnabled(false);
        } else if (opcao.equals("Triângulo")) {
            inBase.setBackground(Color.white);
            inBase.setEnabled(true);

            inAltura.setBackground(Color.white);
            inAltura.setEnabled(true);

            inRaio.setEnabled(false);
            inRaio.setBackground(Color.white);

            inXX.setEnabled(false);
            inYY.setEnabled(false);
            btInserir.setEnabled(false);
            btExcluir.setEnabled(false);
            jCBListaPontos.setEnabled(false);
        } else if (opcao.equals("Círculo")) {
            inRaio.setEnabled(true);
            inRaio.setBackground(Color.white);

            inBase.setEnabled(false);
            inBase.setBackground(Color.white);

            inAltura.setEnabled(false);
            inAltura.setBackground(Color.white);

            inXX.setEnabled(false);
            inYY.setEnabled(false);
            btInserir.setEnabled(false);
            btExcluir.setEnabled(false);
            jCBListaPontos.setEnabled(false);
        } else if (opcao.equals("Semicírculo")) {
            inRaio.setBackground(Color.white);
            inBase.setBackground(Color.white);
            inAltura.setBackground(Color.white);

            inRaio.setEnabled(true);
            inBase.setEnabled(false);
            inAltura.setEnabled(false);
            inXX.setEnabled(false);
            inYY.setEnabled(false);
            btInserir.setEnabled(false);
            btExcluir.setEnabled(false);
            jCBListaPontos.setEnabled(false);
        } else if (opcao.equals("1/4 Círculo")) {
            inRaio.setBackground(Color.white);
            inBase.setBackground(Color.white);
            inAltura.setBackground(Color.white);

            inRaio.setEnabled(true);
            inBase.setEnabled(false);
            inAltura.setEnabled(false);
            inXX.setEnabled(false);
            inYY.setEnabled(false);
            btInserir.setEnabled(false);
            btExcluir.setEnabled(false);
            jCBListaPontos.setEnabled(false);
        } else if (opcao.equals("Outro Polígono")) {
            inRaio.setEnabled(false);
            inBase.setEnabled(false);
            inAltura.setEnabled(false);
            inXX.setEnabled(true);
            inYY.setEnabled(true);
            btInserir.setEnabled(true);
            btExcluir.setEnabled(true);
            jCBListaPontos.setEnabled(true);
        }
        // TODO add your handling code here:
}//GEN-LAST:event_jCBTipoFiguraActionPerformed

    private void jCBTipoFiguraFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jCBTipoFiguraFocusLost
        // TODO Colocar o mesmo codigo de jCBTipoFiguraActionPerformed
}//GEN-LAST:event_jCBTipoFiguraFocusLost

    private void inBaseFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inBaseFocusGained
        // TODO add your handling code here:
}//GEN-LAST:event_inBaseFocusGained

    private void btInserirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btInserirActionPerformed
        // TODO Verificar se são números INTEIROS AQUI
        String ponto = inXX.getText().concat(";").concat(inYY.getText());
        jCBListaPontos.addItem(ponto);

        // Inserir as coordendas do ponto na caixa de combinacao
}//GEN-LAST:event_btInserirActionPerformed

    private void btExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExcluirActionPerformed
        if (jCBListaPontos.getSelectedIndex() != -1) {
            jCBListaPontos.removeItemAt(jCBListaPontos.getSelectedIndex());
        }// Excluir o Ponto Selecionado da caixa de combinacao
        //TODO add your handling code here:
}//GEN-LAST:event_btExcluirActionPerformed

    private void zoomStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_zoomStateChanged
        int num = jCBTipoFigura.getSelectedIndex();
        float fator = zoom.getValue();
        fator = fator/100;

        float b;
        float h;
        float r;
        fig.setFator(fator);

        switch (num) {
            case 0:
                b = (Integer.parseInt(inBase.getText()) * fator);
                h = (Integer.parseInt(inAltura.getText()) * fator);
                fig.desenhaRetangulo(b, h);
                break;
            case 1:
                b = (Integer.parseInt(inBase.getText()) * fator);
                h = (Integer.parseInt(inAltura.getText()) * fator);
                fig.desenhaTriangulo(b, h);
                break;// Triangulo;
            case 2:
                r = (Integer.parseInt(inRaio.getText()) * fator);
                fig.desenhaCirculo(r);
                break;
            case 3:
                r = (Integer.parseInt(inRaio.getText()) * fator );
                fig.desenhaSemiCirculo(r);
                break;
            case 4:
                r = (Integer.parseInt(inRaio.getText()) * fator);
                fig.desenhaQuadrante(r);
                break;
            case 5:
                criaVetorPontos();
                for (int i = 0; i < xs.length; i++) {
                    xs[i] = (int) (xs[i] * fator);
                    ys[i] = (int) (ys[i] * fator);
                }
                fig.desenhaPoligono(xs, ys);
                break;
        }
        // TODO Redesenhar com fator de mudanca do zoom
        // TODO add your handling code here:
}//GEN-LAST:event_zoomStateChanged

    private void btLimparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btLimparActionPerformed
        inBase.setEnabled(false);
        inBase.setBackground(Color.WHITE);

        inBase.setText("");

        inAltura.setEnabled(false);
        inAltura.setBackground(Color.WHITE);
        inAltura.setText("");

        inRaio.setEnabled(false);
        inRaio.setBackground(Color.WHITE);
        inRaio.setText("");

        inIx.setText("Inercia X");
        inIy.setText("Inercia Y");
        inIxy.setText("Produto de Inercia");
        inArea.setText("Area");
        jCBTipoFigura.setSelectedIndex(-1);
        fig.limpaTela();
        zoom.setValue(30);


        // TODO Limpar todos os campos
    }//GEN-LAST:event_btLimparActionPerformed

    private void btCalcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCalcularActionPerformed
        String opcao = String.valueOf(jCBTipoFigura.getSelectedItem());
        double area, ix, iy, ixy;
        Calculo calc = new Calculo();
        try {
            if (opcao.equals("Retângulo")) {
                if (!(inBase.getText().isEmpty() || inAltura.getText().isEmpty())) {
                    inBase.setBackground(Color.WHITE);
                    inAltura.setBackground(Color.white);
                    double ba = Double.parseDouble(inBase.getText());
                    double alt = Double.parseDouble(inAltura.getText());
                    //result = calc.momentInerciaRetangX(ba, alt);
                    inIx.setText(String.valueOf(calc.momentInerciaRetangX((float) ba, (float) alt) + ""));
                    inIy.setText(String.valueOf(calc.momentInerciaRetangY((float) ba, (float) alt)));
                    inArea.setText(String.valueOf(calc.areaRetang((float) ba, (float) alt) + ""));
                    inIxy.setText(String.valueOf(calc.produtoInerciaRetangulo((float) ba, (float) alt)));

                } else {
                    inBase.setBackground(Color.red);
                    inAltura.setBackground(Color.red);
                    JOptionPane.showMessageDialog(null, "Entre com os dados por favor!", "Alerta", JOptionPane.ERROR_MESSAGE);
                }
                // TODO Retangulo
            } else if (opcao.equals("Triângulo")) {
                if (!(inBase.getText().isEmpty() || inAltura.getText().isEmpty())) {
                    inBase.setBackground(Color.WHITE);
                    inAltura.setBackground(Color.white);
                    double ba = Double.parseDouble(inBase.getText());
                    double alt = Double.parseDouble(inAltura.getText());
                    inIx.setText(String.valueOf(calc.momentInerciaTriangX((float) ba, (float) alt)));
                    inIy.setText(String.valueOf(calc.momentInerciaTriangY((float) ba, (float) alt)));
                    inArea.setText(String.valueOf(calc.areaTriang((float) ba, (float) alt)));
                    inIxy.setText(String.valueOf(calc.produtoInerciaTriangulo((float) ba, (float) alt)));

                } else {
                    inBase.setBackground(Color.red);
                    inAltura.setBackground(Color.red);
                    JOptionPane.showMessageDialog(null, "Entre com os dados por favor!", "Alerta", JOptionPane.ERROR_MESSAGE);
                }
            } else if (opcao.equals("Círculo")) {
                if (!(inRaio.getText().isEmpty())) {
                    inRaio.setBackground(Color.WHITE);

                    double r = Double.parseDouble(inRaio.getText());
                    inIx.setText(String.valueOf(calc.momentInerciaCirculoX_Y((float) r)));
                    inIy.setText(String.valueOf(calc.momentInerciaCirculoX_Y((float) r)));
                    inArea.setText(String.valueOf(calc.areaCirculo((float) r)));
                    inIxy.setText(String.valueOf(calc.produtoInerciaCirculo((float) r)));

                } else {
                    inRaio.setBackground(Color.red);
                    JOptionPane.showMessageDialog(null, "Entre com os dados por favor!", "Alerta", JOptionPane.ERROR_MESSAGE);
                }
            } else if (opcao.equals("Semicírculo")) {
                if (!(inRaio.getText().isEmpty())) {
                    inRaio.setBackground(Color.WHITE);

                    double r = Double.parseDouble(inRaio.getText());
                    //zoom.setValue((int) r);
                    inIx.setText(String.valueOf(calc.momentInerciaSemiCirculoX_Y((float) r)));
                    inIy.setText(String.valueOf(calc.momentInerciaSemiCirculoX_Y((float) r)));
                    inArea.setText(String.valueOf(calc.areaSemiCirculo((float) r)));
                    inIxy.setText(String.valueOf(calc.produtoInerciaSemiCirculo((float) r)));
                    // TODO semiciruclo
                } else {
                    inRaio.setBackground(Color.red);
                    JOptionPane.showMessageDialog(null, "Entre com os dados por favor!", "Alerta", JOptionPane.ERROR_MESSAGE);
                }

            } else if (opcao.equals("1/4 Círculo")) {
                if (!(inRaio.getText().isEmpty())) {
                    inRaio.setBackground(Color.WHITE);

                    double r = Double.parseDouble(inRaio.getText());
                    //zoom.setValue((int) r);
                    inIx.setText(String.valueOf(calc.momentInerciaQuartoCirculoX_Y((float) r)));
                    inIy.setText(String.valueOf(calc.momentInerciaQuartoCirculoX_Y((float) r)));
                    inArea.setText(String.valueOf(calc.areaQuartoCirculo((float) r)));
                    inIxy.setText(String.valueOf(calc.produtoInerciaQuartoCirculo((float) r)));
                    // TODO Desenha 1/4 circulo
                } else {
                    inRaio.setBackground(Color.red);
                    JOptionPane.showMessageDialog(null, "Entre com os dados por favor!", "Alerta", JOptionPane.ERROR_MESSAGE);
                }

            } else if (opcao.equals("Outro Polígono")) {
                if (jCBListaPontos.getItemCount() != 0) {
                    criaVetorPontos();

                    inIx.setText(String.valueOf(calc.momentInerciaPoligonoX(xs, ys)));
                    inIy.setText(String.valueOf(calc.momentInerciaPoligonoY(xs, ys)));
                    inArea.setText(String.valueOf(calc.areaPoligono(xs, ys)));
                    inIxy.setText(String.valueOf(calc.produtoInerciaPoligono(xs, ys)));
                }
                // TODO Capturar Lista
            }
            // TODO Calcular os momentos de inercia e o produto de inercia
            // TODO Colocando os Calculos nas caixas
            // TODO add your handling code here:
            double ixR = Double.parseDouble(inIx.getText());
            double iyR = Double.parseDouble(inIy.getText());
            double ixyR = Double.parseDouble(inIxy.getText());
            resultSeccao = new ResultadoSeccao(ixR, iyR, ixyR);
//            graficoDeformada.setEnabled(true);
//            exibeDeformada.setEnabled(true);
            if(!opcaoGrafico){
                calcula();
                converteGrafico();
            }
            //Habilita Circulo de Mohr
            buttonMohr.setEnabled(true);
            this.buttonExecMohr.setEnabled(true);
            setVisibleAnguloMohr(true);
            if (enableCarga) {
                exibeDeformada.setEnabled(true);
                graficoDeformada.setEnabled(true);
            }
        } 
        catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Entre com os dados por favor!", "Alerta", JOptionPane.ERROR_MESSAGE);
        }

}//GEN-LAST:event_btCalcularActionPerformed

    private void btPlotarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btPlotarActionPerformed
        // alteraFigura();
        String opcao = String.valueOf(jCBTipoFigura.getSelectedItem());

        //fig.setFator(zoom.getValue()/10);
        if (opcao.equals("Retângulo")) {
            if (!(inBase.getText().isEmpty() || inAltura.getText().isEmpty())) {
                inBase.setBackground(Color.WHITE);
                inAltura.setBackground(Color.white);
                fig.desenhaRetangulo(Integer.parseInt(inBase.getText()), Integer.parseInt(inAltura.getText()));

            } else {
                inBase.setBackground(Color.red);
                inAltura.setBackground(Color.red);
            }
            // TODO Retangulo
        } else if (opcao.equals("Triângulo")) {
            if (!(inBase.getText().isEmpty() || inAltura.getText().isEmpty())) {
                inBase.setBackground(Color.WHITE);
                inAltura.setBackground(Color.white);
                fig.desenhaTriangulo(Integer.parseInt(inBase.getText()), Integer.parseInt(inAltura.getText()));

            } else {
                inBase.setBackground(Color.red);
                inAltura.setBackground(Color.red);
            }
        } else if (opcao.equals("Círculo")) {
            if (!(inRaio.getText().isEmpty())) {
                inRaio.setBackground(Color.WHITE);
                fig.desenhaCirculo(Double.parseDouble(inRaio.getText()));

            } else {
                inRaio.setBackground(Color.RED);
            }
        } else if (opcao.equals("Semicírculo")) {
            if (!(inRaio.getText().isEmpty())) {
                inRaio.setBackground(Color.WHITE);
                fig.desenhaSemiCirculo(Integer.parseInt(inRaio.getText()));
                // TODO semiciruclo
            } else {
                inRaio.setBackground(Color.RED);
            }

        } else if (opcao.equals("1/4 Círculo")) {
            if (!(inRaio.getText().isEmpty())) {
                inRaio.setBackground(Color.WHITE);
                fig.desenhaQuadrante(Double.parseDouble(inRaio.getText()));
                // TODO Desenha 1/4 circulo
            } else {
                inRaio.setBackground(Color.RED);
            }

        } else if (opcao.equals("Outro Polígono")) {
            if (jCBListaPontos.getItemCount() > 3) {
                criaVetorPontos();
                fig.desenhaPoligono(xs, ys);
            }
            // TODO Capturar Lista
        }
        // TODO Codigo pra desenhar figura
        // TODO add your handling code here:
}//GEN-LAST:event_btPlotarActionPerformed

    private void exibeDeformadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exibeDeformadaActionPerformed
        if(exibeDeformada.isSelected()){
            opcaoValor = false;
            calcula();
            
            //panelPrincipal1.setDeformadaValor(true);

            exibeEsforco.setSelected(false);
            exibeMomento.setSelected(false);

            //panelPrincipal1.setEsforcoCortante(false);
            //panelPrincipal1.setMomentoFletor(false);
            panelPrincipal1.repaint();
            panelPrincipal1.validate();

        }
    }//GEN-LAST:event_exibeDeformadaActionPerformed

    private void jTXVigajTXVigaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTXVigajTXVigaActionPerformed
        eventoJTxViga();
    }//GEN-LAST:event_jTXVigajTXVigaActionPerformed

    private void jTXConcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTXConcActionPerformed
        eventoTXConc();
    }//GEN-LAST:event_jTXConcActionPerformed

    private void jTForcaConcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTForcaConcActionPerformed
        eventoJTForcaConc();
    }//GEN-LAST:event_jTForcaConcActionPerformed

    private void jTtamDistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTtamDistActionPerformed
        eventoJTTamDist();
    }//GEN-LAST:event_jTtamDistActionPerformed

    private void jTXDistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTXDistActionPerformed
        eventoJTxDist();
    }//GEN-LAST:event_jTXDistActionPerformed

    private void jTForcaDistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTForcaDistActionPerformed
        eventoJTxForcaDist();
    }//GEN-LAST:event_jTForcaDistActionPerformed

    private void jTXMomentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTXMomentoActionPerformed
        eventoTXMom();
    }//GEN-LAST:event_jTXMomentoActionPerformed

    private void jTForcaMomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTForcaMomActionPerformed
        eventoJTForcaMom();
    }//GEN-LAST:event_jTForcaMomActionPerformed

    private void jTTamVigaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTTamVigaActionPerformed
       eventoJTTamViga();
    }//GEN-LAST:event_jTTamVigaActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new JanelaPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btCalcular;
    private javax.swing.JButton btExcluir;
    private javax.swing.JButton btInserir;
    private javax.swing.JButton btLimpar;
    private javax.swing.JButton btPlotar;
    private javax.swing.JButton buttonExecMohr;
    private javax.swing.JButton buttonMohr;
    private javax.swing.JButton buttonSeccao;
    private javax.swing.JCheckBox exibeDeformada;
    private javax.swing.JCheckBox exibeEsforco;
    private javax.swing.JCheckBox exibeGraficoEC;
    private javax.swing.JCheckBox exibeGraficoMF;
    private javax.swing.JCheckBox exibeMomento;
    private javax.swing.JCheckBox graficoDeformada;
    private javax.swing.JTextField inAltura;
    private javax.swing.JTextField inArea;
    private javax.swing.JTextField inBase;
    private javax.swing.JTextField inIx;
    private javax.swing.JTextField inIxy;
    private javax.swing.JTextField inIy;
    private javax.swing.JTextField inRaio;
    private javax.swing.JTextField inXX;
    private javax.swing.JTextField inYY;
    private javax.swing.JComboBox jCBListaPontos;
    private javax.swing.JComboBox jCBTipoFigura;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelResultadosMohr;
    private javax.swing.JPanel jPCargas;
    private javax.swing.JPanel jPExibirTela;
    private javax.swing.JPanel jPIConcentrada;
    private javax.swing.JPanel jPIDistribuida;
    private javax.swing.JPanel jPIViga;
    private javax.swing.JPanel jPInform;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JPanel jPanelFigura;
    private InterfaceCirculoMohr.PanelCirculoMohr2 jPanelMohr;
    private javax.swing.JRadioButton jRConcentrada;
    private javax.swing.JRadioButton jRDistribuida;
    private javax.swing.JRadioButton jRMomento;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToggleButton jTDesenhoViga;
    private javax.swing.JTextField jTForcaConc;
    private javax.swing.JTextField jTForcaDist;
    private javax.swing.JTextField jTForcaMom;
    private javax.swing.JTextField jTTamViga;
    private javax.swing.JTextField jTXConc;
    private javax.swing.JTextField jTXDist;
    private javax.swing.JTextField jTXMomento;
    private javax.swing.JTextField jTXViga;
    private javax.swing.JTextArea jTextAreaResultadosMohr;
    private javax.swing.JTextField jTextFieldAnguloMohr;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JTextField jTtamDist;
    private javax.swing.JLabel labelForcaConc;
    private javax.swing.JLabel labelForcaDist;
    private javax.swing.JLabel labelForcaMom;
    private javax.swing.JLabel labelMTDist;
    private javax.swing.JLabel labelMTViga;
    private javax.swing.JLabel labelMXConc;
    private javax.swing.JLabel labelMXDist;
    private javax.swing.JLabel labelMXMom;
    private javax.swing.JLabel labelMXViga;
    private javax.swing.JLabel labelNConc;
    private javax.swing.JLabel labelNDist;
    private javax.swing.JLabel labelNMom;
    private javax.swing.JLabel labelTDist;
    private javax.swing.JLabel labelTViga;
    private javax.swing.JLabel labelXConc;
    private javax.swing.JLabel labelXDist;
    private javax.swing.JLabel labelXMom;
    private javax.swing.JLabel labelXViga;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JPanel panelCirculo;
    private javax.swing.JPanel panelEsforcos;
    private javax.swing.JTabbedPane panelGrafico3;
    private javax.swing.JPanel panelGraficoD;
    private javax.swing.JPanel panelGraficoEC;
    private javax.swing.JPanel panelGraficoMF;
    private InterfaceEI.PanelPrincipal panelPrincipal1;
    private javax.swing.JPanel panelSeccao;
    private javax.swing.JTabbedPane tabbedPrincipal;
    private javax.swing.JTextField textFieldXpixel;
    private javax.swing.JTextField textFieldXreal;
    private javax.swing.JTextField textFieldYpixel;
    private javax.swing.JTextField textFieldYreal;
    private javax.swing.JSlider zoom;
    // End of variables declaration//GEN-END:variables


    public void calcula(){

//        CalculaDistribuida cargaDistribuida= new CalculaDistribuida(xViga);
//        panelGrafico1.add(cargaDistribuida.CalculaCargaDistribuida(forcaD, tamanhoD,tamanhoViga,xDistribuida));
//        panelGrafico1.repaint();
//        panelGrafico1.validate();
//        panelGrafico1.setVisible(true);


//        panelGrafico3.removeAll();
//        panelGrafico3.removeAll();
        panelGraficoMF.removeAll();
        panelGraficoEC.removeAll();
        panelGraficoD.removeAll();

        if(opcaoGrafico){
        diagramas = new CalcularDiagrama(tamanhoViga, xViga, forcaC, forcaD, xConcentrada, xDistribuida, tamanhoD,forcaM,xMomento,
                jRDistribuida.isSelected(), jRConcentrada.isSelected(),jRMomento.isSelected(),(fixoD||distF),engstP,pontoE, opcaoGrafico);
        }
        if(!opcaoValor || !opcaoGrafico){
            diagramas = new CalcularDiagrama(tamanhoViga, xViga, forcaC, forcaD, xConcentrada, xDistribuida, tamanhoD,forcaM,xMomento,
                jRDistribuida.isSelected(), jRConcentrada.isSelected(),jRMomento.isSelected(),(fixoD||distF),engstP,pontoE, resultSeccao.getiY(),opcaoGrafico);
        }
        
//        if(!opcaoValor){
//            diagramas = new CalcularDiagrama(tamanhoViga, xViga, forcaC, forcaD, xConcentrada, xDistribuida, tamanhoD,forcaM,xMomento,
//                jRDistribuida.isSelected(), jRConcentrada.isSelected(),jRMomento.isSelected(),(fixoD||distF),engstP,pontoE, resultSeccao.getiY(),opcaoGrafico);
//        }
//        else{
//            diagramas = new CalcularDiagrama(tamanhoViga, xViga, forcaC, forcaD, xConcentrada, xDistribuida, tamanhoD,forcaM,xMomento,
//                jRDistribuida.isSelected(), jRConcentrada.isSelected(),jRMomento.isSelected(),(fixoD||distF),engstP,pontoE, opcaoGrafico);
//        }
        graficosDiagramas = diagramas.calculaDiagramas();///na ordem apoio fixo, engastado, engastado Invertido
//        panelGrafico3.add(graficosDiagramas[0]);
//        panelGrafico3.add(graficosDiagramas[1]);
//        panelGrafico3.repaint();
//        panelGrafico3.repaint();
//        panelGrafico3.validate();
//        panelGrafico3.validate();

        panelGraficoMF.add(graficosDiagramas[0]);
        panelGraficoMF.repaint();
        panelGraficoMF.validate();

        panelGraficoEC.add(graficosDiagramas[1]);
        panelGraficoEC.repaint();
        panelGraficoEC.validate();

        if(!opcaoGrafico){
            panelGraficoD.add(graficosDiagramas[2]);
            panelGraficoD.repaint();
            panelGraficoD.validate();
        }
        
        if (panelPrincipal1.getFixoD() || panelPrincipal1.getDesliF()) {
            panelPrincipal1.setReacaoBiapoiadaA(true);
            panelPrincipal1.setReacaoBiapoiadaB(true);

            panelPrincipal1.setBiapoiadaA(diagramas.getReacaoBiemA());
            panelPrincipal1.setBiapoiadaB(diagramas.getReacaoBiemB());
        } 
        else if(panelPrincipal1.getEngP()){
            panelPrincipal1.setReacaoBiapoiadaA(false);
            panelPrincipal1.setReacaoBiapoiadaB(false);

            panelPrincipal1.setReacaoEngastada(true);
            panelPrincipal1.setValorReacaoE(diagramas.getReacaoApoioEngastado());
        }

       
    }

    public void limparTiposApoios(){
        fixoD = false;
        distF = false;
        pontoE = false;
        engstP = false;
    }

    public void setTamViga(){
        int tP = panelPrincipal1.getxFim() - panelPrincipal1.getxInicio();
        tamanhoViga = utili.conversaoPixelMX(tP, panelPrincipal1.getWidth());
    }

    public void setjTTamViga(){
        String a;
        a = String.valueOf(df.format(tamanhoViga));
        System.out.println(a);
        jTTamViga.setText(a);
    }

    

    public void setInicioViga(){
        int x = panelPrincipal1.getxInicio();
        xViga = utili.conversaoPixelMX(x, panelPrincipal1.getWidth());
        setTextXViga();
    }

    public void setTipoViga(){
        fixoD = panelPrincipal1.getFixoD();
        distF = panelPrincipal1.getDesliF();
        pontoE = panelPrincipal1.getPontoE();
        engstP = panelPrincipal1.getEngP();
    }

    public void setTextForcaC(){
        String a;
       
        a = String.valueOf(df.format(forcaC));
        System.out.println(forcaC);
        System.out.println("Força: " +a);
        jTForcaConc.setText(a);
    }

    public void setTextXc(){
        //xConcentrada = (xConcentrada - utili.conversaoPixelMX(panelPrincipal1.getxInicio(), panelPrincipal1.getWidth()));
        String a;
        a = String.valueOf(df.format(xConcentrada));
        jTXConc.setText(a);
    }
    
    public void setTextForcaDist(){
        String a;
       
        a = String.valueOf(df.format(forcaD));
        jTForcaDist.setText(a);
        
    }

    public void setTextXDist(){
        //xDistribuida = (xDistribuida - utili.conversaoPixelMX(panelPrincipal1.getxInicio(), panelPrincipal1.getWidth()));
        System.out.println("XD Depois: " +xDistribuida);
        String a;
        a = String.valueOf(df.format(xDistribuida));
        jTXDist.setText(a);
    }

    public void setTextTamDist(){
        String a;
        a = String.valueOf(df.format(tamanhoD));
        jTtamDist.setText(a);
    }

    public void setTextXViga(){
        String a;
        a = String.valueOf(df.format(xViga));
        jTXViga.setText(a);
    }

    public void setTextXMom(){
        String a;
        a = String.valueOf(df.format(xMomento));
        jTXMomento.setText(a);
    }

    public void setTextForcaMom(){
        String a;
        a = String.valueOf(df.format(forcaM));
        jTForcaMom.setText(a);
    }


    public void setTamanhoViga(double tamanhoViga) {
        this.tamanhoViga = tamanhoViga;
    }

    public void setForcaC(double forcaC) {
        this.forcaC = forcaC;
    }

    public void setForcaD(double forcaD) {
        this.forcaD = forcaD;
    }

    public void setxConcentrada(double xConcentrada) {
        this.xConcentrada = xConcentrada;
    }

    public void setxDistribuida(double xDistribuida) {
        this.xDistribuida = xDistribuida;
    }

    public void setxMomento(double xMomento) {
        this.xMomento = xMomento;
    }

    public void setForcaM(double forcaM) {
        this.forcaM = forcaM;
    }

    

    public void setTamanhoD(double tamanhoD) {
        this.tamanhoD = tamanhoD;
    }

    public void setFixoD(boolean fixoD) {
        this.fixoD = fixoD;
    }

    public void setDistF(boolean distF) {
        this.distF = distF;
    }

    public void setPontoE(boolean pontoE) {
        this.pontoE = pontoE;
    }

    public void setEngstP(boolean engstP) {
        this.engstP = engstP;
    }

    public CalcularDiagrama getDiagramas() {
        return diagramas;
    }

    public double getForcaC() {
        return forcaC;
    }

    public double getForcaD() {
        return forcaD;
    }

    public double getForcaM() {
        return forcaM;
    }
    

    public JTextField getjTTamViga() {
        return jTTamViga;
    }

    public PanelPrincipal getPanelPrincipal1() {
        return panelPrincipal1;
    }

    public double getTamanhoViga() {
        return tamanhoViga;
    }

    public JCheckBox getExibeEsforco() {
        return exibeEsforco;
    }

    public JCheckBox getExibeGraficoEC() {
        return exibeGraficoEC;
    }

    public JCheckBox getExibeGraficoMF() {
        return exibeGraficoMF;
    }
    
    public JCheckBox getExibeGraficoD() {
        return graficoDeformada;
    }


    public JCheckBox getExibeMomento() {
        return exibeMomento;
    }

    public boolean getEnableCarga(){
        return enableCarga;
    }
    

    

    public void eventoJTTamViga(){
        String text = new String();
        text = jTTamViga.getText();
        if (!text.equalsIgnoreCase("")) {
            try {
                text = text.replaceAll(",", ".");
                double teste = Double.parseDouble(text);
                double t = utili.conversaoMPixelX(teste, panelPrincipal1.getWidth());

                int xF = (int) Math.abs(panelPrincipal1.getxInicio() + t);
                int aux;
                if(panelPrincipal1.getxConcentrada() > panelPrincipal1.getxFimDist()){
                    aux = panelPrincipal1.getxConcentrada();
                }
                else{
                    aux = panelPrincipal1.getxFimDist();
                }

                if (xF <= panelPrincipal1.getWidth() && (xF >= aux)) {

                    tamanhoViga = teste;
                    panelPrincipal1.setxFim(xF);

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();

                }
                else{
                    jTTamViga.removeFocusListener(eventoTextTV);
                    JOptionPane.showMessageDialog(null, "Tamanho Invalido!");
                    jTTamViga.addFocusListener(eventoTextTV);
                }
                setjTTamViga();
            }
            catch (NumberFormatException ex) {
                jTTamViga.removeFocusListener(eventoTextTV);
                JOptionPane.showMessageDialog(null, "Formato de numero Invalido!");
                setjTTamViga();
                jTTamViga.addFocusListener(eventoTextTV);
            }
            if(enableCarga){
                calcula();
                converteGrafico();

                if (exibeGraficoMF.isSelected()) {

                     panelPrincipal1.setFletor(pontosFletor);

                     panelPrincipal1.setGraficoFletor(true);

                     panelPrincipal1.repaint();
                     panelPrincipal1.validate();
                 }
                 if (exibeGraficoEC.isSelected()) {

                     panelPrincipal1.setCortante(pontosCortante);

                     panelPrincipal1.setGraficoCortante(true);

                     panelPrincipal1.repaint();
                     panelPrincipal1.validate();
                 }
             }
        }
    }

    public JTextField getjTXViga() {
        return jTXViga;
    }



    public void eventoJTxViga(){
        String text = new String();
        text = jTXViga.getText();
        if (!text.equalsIgnoreCase("")) {
            try {
                text = text.replaceAll(",", ".");
                double teste = Double.parseDouble(text);
                double t = utili.conversaoMPixelX(teste, panelPrincipal1.getWidth());

                int aux;
                if (jRConcentrada.isSelected() && jRDistribuida.isSelected() && jRMomento.isSelected()) {
                    if (panelPrincipal1.getxConcentrada() < panelPrincipal1.getxInicioDist()) {
                        if(panelPrincipal1.getxConcentrada() < panelPrincipal1.getxCMomento()){
                            aux = panelPrincipal1.getxConcentrada();
                        }
                        else{
                            aux = panelPrincipal1.getxCMomento();
                        }
                    }
                    else if (panelPrincipal1.getxCMomento() < panelPrincipal1.getxInicioDist()) {
                        aux = panelPrincipal1.getxCMomento();
                    }
                    else {
                        aux = panelPrincipal1.getxInicioDist();
                    }
                }
                else if(jRConcentrada.isSelected() && jRDistribuida.isSelected()){
                    if (panelPrincipal1.getxConcentrada() < panelPrincipal1.getxInicioDist()) {
                        aux = panelPrincipal1.getxConcentrada();
                    }
                    else {
                        aux = panelPrincipal1.getxInicioDist();
                    }
                }
                else if (jRConcentrada.isSelected() && jRMomento.isSelected()) {
                    if (panelPrincipal1.getxConcentrada() < panelPrincipal1.getxCMomento()) {
                        aux = panelPrincipal1.getxConcentrada();
                    } 
                    else {
                        aux = panelPrincipal1.getxCMomento();
                    }
                }
                else if (jRDistribuida.isSelected() && jRMomento.isSelected()) {
                    if (panelPrincipal1.getxInicioDist() < panelPrincipal1.getxCMomento()) {
                        aux = panelPrincipal1.getxInicioDist();
                    } 
                    else {
                        aux = panelPrincipal1.getxCMomento();
                    }
                }
                else{
                    if(jRConcentrada.isSelected()){
                        aux = panelPrincipal1.getxConcentrada();
                    }
                    else if(jRDistribuida.isSelected()){
                        aux = panelPrincipal1.getxInicioDist();
                    }
                    else if(jRMomento.isSelected()){
                        aux = panelPrincipal1.getxCMomento();
                    }
                    else{
                        aux = panelPrincipal1.getxInicio();
                    }
                }

                if(t < panelPrincipal1.getxFim()){
                    xViga = teste;
                    panelPrincipal1.setxInicio((int) t);

                    setTamViga();
                    setjTTamViga();
                    
                    

                    int xI;
                    if (panelPrincipal1.getxInicioDist() < panelPrincipal1.getxFimDist()) {
                        xI = panelPrincipal1.getxInicioDist();
                    }
                    else {
                        xI = panelPrincipal1.getxFimDist();
                    }
                    
                    if(jRConcentrada.isSelected()){
                        double x = utili.conversaoPixelMX((panelPrincipal1.getxConcentrada() - panelPrincipal1.getxInicio()), panelPrincipal1.getWidth());
                        xConcentrada = x;
                        setTextXc();
                    }

                    if (jRDistribuida.isSelected()) {
                        //atribuindo a coordenada x do inicio da carga distribuida na classe principal (Frame)
                        double x = utili.conversaoPixelMX(xI - panelPrincipal1.getxInicio(), panelPrincipal1.getWidth());
                        xDistribuida = x;
                        setTextXDist();
                    }
                    
                    if(jRMomento.isSelected()){
                        double x = utili.conversaoPixelMX((panelPrincipal1.getxCMomento() - panelPrincipal1.getxInicio()), panelPrincipal1.getWidth());
                        xMomento= x;
                        setTextXMom();
                    }

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }
                else{
                    jTXViga.removeFocusListener(eventoTextTV);
                    JOptionPane.showMessageDialog(null, "Posição Invalida!");
                    jTXViga.addFocusListener(eventoTextTV);
                }
                setTextXViga();
                if (enableCarga) {
                    calcula();
                    converteGrafico();

                    if (exibeGraficoMF.isSelected()) {

                        panelPrincipal1.setFletor(pontosFletor);

                        panelPrincipal1.setGraficoFletor(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                    if (exibeGraficoEC.isSelected()) {

                        panelPrincipal1.setCortante(pontosCortante);

                        panelPrincipal1.setGraficoCortante(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                }

            }
            catch (NumberFormatException ex) {
                jTXViga.removeFocusListener(eventoTextTV);
                JOptionPane.showMessageDialog(null, "Formato de numero Invalido!");
                setTextXViga();
                jTXViga.addFocusListener(eventoTextTV);
            }
        }
    }

    public JTextField getjTXConc() {
        return jTXConc;
    }


    public void eventoTXConc(){
        String text = new String();
        text = jTXConc.getText();
        if (!text.equalsIgnoreCase("")) {
            try {
                text = text.replaceAll(",", ".");
                double teste = Double.parseDouble(text);
                double t = utili.conversaoMPixelX(teste, panelPrincipal1.getWidth());

                if(((t + panelPrincipal1.getxInicio()) <= panelPrincipal1.getxFim()) && ((t+ panelPrincipal1.getxInicio()) >= panelPrincipal1.getxInicio())){
                    panelPrincipal1.setxConcentrada((int) t + panelPrincipal1.getxInicio());
                    //xConcentrada = teste + utili.conversaoPixelMX(panelPrincipal1.getxInicio(), panelPrincipal1.getWidth());
                    xConcentrada = teste;

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }
                else{
                    jTXConc.removeFocusListener(eventoTextTV);
                    JOptionPane.showMessageDialog(null, "Posição Invalida!");
                    jTXConc.addFocusListener(eventoTextTV);
                }
                if (enableCarga) {
                    calcula();
                    converteGrafico();

                    if (exibeGraficoMF.isSelected()) {

                        panelPrincipal1.setFletor(pontosFletor);

                        panelPrincipal1.setGraficoFletor(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                    if (exibeGraficoEC.isSelected()) {

                        panelPrincipal1.setCortante(pontosCortante);

                        panelPrincipal1.setGraficoCortante(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                }
                setTextXc();

            }
            catch (NumberFormatException ex) {
                jTXConc.removeFocusListener(eventoTextTV);
                JOptionPane.showMessageDialog(null, "Formato de numero Invalido!");
                setTextXc();
                jTXConc.addFocusListener(eventoTextTV);
            }
        }
    }

    public JTextField getjTForcaConc() {
        return jTForcaConc;
    }
    

    public void eventoJTForcaConc(){
        String text = new String();
        text = jTForcaConc.getText();
        if (!text.equalsIgnoreCase("")) {
            try {
                text = text.replaceAll(",", ".");
                double teste = Double.parseDouble(text);
                forcaC = teste;

                setTextForcaC();

                if(enableCarga){
                    calcula();
                    converteGrafico();

                    if (exibeGraficoMF.isSelected()) {

                        panelPrincipal1.setFletor(pontosFletor);

                        panelPrincipal1.setGraficoFletor(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                    if (exibeGraficoEC.isSelected()) {

                        panelPrincipal1.setCortante(pontosCortante);

                        panelPrincipal1.setGraficoCortante(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                }

            }
            catch (NumberFormatException ex) {
                jTForcaConc.removeFocusListener(eventoTextTV);
                JOptionPane.showMessageDialog(null, "Formato de numero Invalido!");
                setTextForcaC();
                jTForcaConc.addFocusListener(eventoTextTV);
            }
        }
    }

    public JTextField getjTtamDist() {
        return jTtamDist;
    }
    
    public void eventoJTTamDist(){
        String text = new String();
        text = jTtamDist.getText();
        if (!text.equalsIgnoreCase("")) {
            try {
                text = text.replaceAll(",", ".");
                double teste = Double.parseDouble(text);

                double t = utili.conversaoMPixelX(teste, panelPrincipal1.getWidth());


                int xF = (int) Math.abs(panelPrincipal1.getxInicioDist() + t);
                if (xF <= panelPrincipal1.getxFim()) {
                    tamanhoD = teste;
                    panelPrincipal1.setxFimDist(xF);

                    System.out.println("XF: " + xF);
                    System.out.println("XI: " + panelPrincipal1.getxInicioDist());

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }
                else{
                    jTtamDist.removeFocusListener(eventoTextTV);
                    JOptionPane.showMessageDialog(null, "Tamanho Invalido!");
                    jTtamDist.addFocusListener(eventoTextTV);
                }
                setTextTamDist();
            }
            catch (NumberFormatException ex) {
                jTtamDist.removeFocusListener(eventoTextTV);
                JOptionPane.showMessageDialog(null, "Formato de numero Invalido!");
                setTextTamDist();
                jTtamDist.addFocusListener(eventoTextTV);
            }
            if(enableCarga){
                calcula();

                converteGrafico();

                if (exibeGraficoMF.isSelected()) {

                     panelPrincipal1.setFletor(pontosFletor);

                     panelPrincipal1.setGraficoFletor(true);

                     panelPrincipal1.repaint();
                     panelPrincipal1.validate();
                 }
                 if (exibeGraficoEC.isSelected()) {

                     panelPrincipal1.setCortante(pontosCortante);

                     panelPrincipal1.setGraficoCortante(true);

                     panelPrincipal1.repaint();
                     panelPrincipal1.validate();
                 }
            }
        }
    }

    public JTextField getjTXDist() {
        return jTXDist;
    }

    
    public void eventoJTxDist(){
        String text = new String();
        text = jTXDist.getText();
        System.out.println("XD Antes: " +xDistribuida);
        double aux = xDistribuida;
        if (!text.equalsIgnoreCase("")) {
            try {
                text = text.replaceAll(",", ".");
                double teste = Double.parseDouble(text);
                double t = utili.conversaoMPixelX(teste, panelPrincipal1.getWidth());

                if(((t + panelPrincipal1.getxInicio()) <= panelPrincipal1.getxFimDist()) && ((t+ panelPrincipal1.getxInicio()) >= panelPrincipal1.getxInicio())){
                    panelPrincipal1.setxInicioDist((int) t + panelPrincipal1.getxInicio());
                    //xDistribuida = teste + utili.conversaoPixelMX(panelPrincipal1.getxInicio(), panelPrincipal1.getWidth());
                    xDistribuida = teste;
                    int tamAux = panelPrincipal1.getxFimDist() - panelPrincipal1.getxInicioDist();
                    tamanhoD = utili.conversaoPixelMX(tamAux, panelPrincipal1.getWidth());
                    setTextTamDist();

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }
                else{
                    jTXDist.removeFocusListener(eventoTextTV);
                    JOptionPane.showMessageDialog(null, "Posição Invalida!");
                    //xDistribuida = aux + utili.conversaoPixelMX(panelPrincipal1.getxInicio(), panelPrincipal1.getWidth());;
                     jTXDist.addFocusListener(eventoTextTV);
                }
                setTextXDist();
                if (enableCarga) {
                    calcula();
                    converteGrafico();

                    if (exibeGraficoMF.isSelected()) {

                        panelPrincipal1.setFletor(pontosFletor);

                        panelPrincipal1.setGraficoFletor(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                    if (exibeGraficoEC.isSelected()) {

                        panelPrincipal1.setCortante(pontosCortante);

                        panelPrincipal1.setGraficoCortante(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                }

            }
            catch (NumberFormatException ex) {
                jTXDist.removeFocusListener(eventoTextTV);
                JOptionPane.showMessageDialog(null, "Formato de numero Invalido!");
                setTextXDist();
                jTXDist.addFocusListener(eventoTextTV);
            }
        }
    }

    public JTextField getjTForcaDist() {
        return jTForcaDist;
    }
   

    public void eventoJTxForcaDist(){
        String text = new String();
        text = jTForcaDist.getText();
        if (!text.equalsIgnoreCase("")) {
            try {
                text = text.replaceAll(",", ".");
                double teste = Double.parseDouble(text);
                forcaD = teste;

                setTextForcaDist();

                if (enableCarga) {
                    calcula();
                    converteGrafico();

                    if (exibeGraficoMF.isSelected()) {

                        panelPrincipal1.setFletor(pontosFletor);

                        panelPrincipal1.setGraficoFletor(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                    if (exibeGraficoEC.isSelected()) {

                        panelPrincipal1.setCortante(pontosCortante);

                        panelPrincipal1.setGraficoCortante(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
               }

            }
            catch (NumberFormatException ex) {
                jTForcaDist.removeFocusListener(eventoTextTV);
                JOptionPane.showMessageDialog(null, "Formato de numero Invalido!");
                setTextForcaDist();
                jTForcaDist.addFocusListener(eventoTextTV);
            }
        }
    }
    
    public JTextField getTextXMom(){
        return jTXMomento;
    }

    public void eventoTXMom(){
        String text = new String();
        text = jTXMomento.getText();
        if (!text.equalsIgnoreCase("")) {
            try {
                text = text.replaceAll(",", ".");
                double teste = Double.parseDouble(text);
                double t = utili.conversaoMPixelX(teste, panelPrincipal1.getWidth());

                if(((t + panelPrincipal1.getxInicio()) <= panelPrincipal1.getxFim()) && ((t+ panelPrincipal1.getxInicio()) >= panelPrincipal1.getxInicio())){
                    panelPrincipal1.setxCMomento((int) t + panelPrincipal1.getxInicio());
                    //xConcentrada = teste + utili.conversaoPixelMX(panelPrincipal1.getxInicio(), panelPrincipal1.getWidth());
                    xMomento = teste;

                    panelPrincipal1.repaint();
                    panelPrincipal1.validate();
                }
                else{
                    jTXMomento.removeFocusListener(eventoTextTV);
                    JOptionPane.showMessageDialog(null, "Posição Invalida!");
                    jTXMomento.addFocusListener(eventoTextTV);
                }
                if (enableCarga) {
                    calcula();
                    converteGrafico();

                    if (exibeGraficoMF.isSelected()) {

                        panelPrincipal1.setFletor(pontosFletor);

                        panelPrincipal1.setGraficoFletor(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                    if (exibeGraficoEC.isSelected()) {

                        panelPrincipal1.setCortante(pontosCortante);

                        panelPrincipal1.setGraficoCortante(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                }
                setTextXMom();

            }
            catch (NumberFormatException ex) {
                jTXMomento.removeFocusListener(eventoTextTV);
                JOptionPane.showMessageDialog(null, "Formato de numero Invalido!");
                setTextXMom();
                jTXMomento.addFocusListener(eventoTextTV);
            }
        }
    }

    public JTextField getjTForcaMom() {
        return jTForcaMom;
    }


    public void eventoJTForcaMom(){
        String text = new String();
        text = jTForcaMom.getText();
        if (!text.equalsIgnoreCase("")) {
            try {
                text = text.replaceAll(",", ".");
                double teste = Double.parseDouble(text);
                forcaM = teste;

                setTextForcaMom();

                if (enableCarga) {
                    calcula();

                    converteGrafico();

                    if (exibeGraficoMF.isSelected()) {

                        panelPrincipal1.setFletor(pontosFletor);

                        panelPrincipal1.setGraficoFletor(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                    if (exibeGraficoEC.isSelected()) {

                        panelPrincipal1.setCortante(pontosCortante);

                        panelPrincipal1.setGraficoCortante(true);

                        panelPrincipal1.repaint();
                        panelPrincipal1.validate();
                    }
                }

            }
            catch (NumberFormatException ex) {
                jTForcaMom.removeFocusListener(eventoTextTV);
                JOptionPane.showMessageDialog(null, "Formato de numero Invalido!");
                setTextForcaMom();
                jTForcaMom.addFocusListener(eventoTextTV);
            }
        }
    }


    public void setVisibleInfoViga(boolean opcao){

        if(opcao){
            jTTamViga.setEditable(true);
            jTTamViga.setEnabled(true);
            jTTamViga.setBorder(bordaI);

            jTXViga.setEditable(true);
            jTXViga.setEnabled(true);
            jTXViga.setBorder(bordaI);

            labelTViga.setEnabled(true);
            labelMTViga.setEnabled(true);
            labelXViga.setEnabled(true);
            labelMXViga.setEnabled(true);
        }
        else{
            jTTamViga.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210)));
            jTXViga.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210)));

            jTTamViga.setText("");
            jTXViga.setText("");

            labelTViga.setEnabled(false);
            labelMTViga.setEnabled(false);
            labelXViga.setEnabled(false);
            labelMXViga.setEnabled(false);
        }

    }
    
    public void setVisibleInfoConcentrada(boolean opcao){

        if(opcao){
            jTXConc.setEditable(true);
            jTXConc.setEnabled(true);
            jTXConc.setBorder(bordaI);

            jTForcaConc.setEditable(true);
            jTForcaConc.setEnabled(true);
            jTForcaConc.setBorder(bordaI);

            labelXConc.setEnabled(true);
            labelMXConc.setEnabled(true);

            labelForcaConc.setEnabled(true);
            labelNConc.setEnabled(true);
        }
        else{
            jTXConc.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210)));
            jTForcaConc.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210)));

            jTXConc.setText("");
            jTForcaConc.setText("");

            labelXConc.setEnabled(false);
            labelMXConc.setEnabled(false);

            labelForcaConc.setEnabled(false);
            labelNConc.setEnabled(false);
        }

    }

    public void setVisibleInfoDistribuida(boolean opcao){

        if(opcao){
            jTXDist.setEditable(true);
            jTXDist.setEnabled(true);
            jTXDist.setBorder(bordaI);

            jTtamDist.setEditable(true);
            jTtamDist.setEnabled(true);
            jTtamDist.setBorder(bordaI);

            jTForcaDist.setEditable(true);
            jTForcaDist.setEnabled(true);
            jTForcaDist.setBorder(bordaI);

            labelXDist.setEnabled(true);
            labelMXDist.setEnabled(true);

            labelForcaDist.setEnabled(true);
            labelNDist.setEnabled(true);

            labelTDist.setEnabled(true);
            labelMTDist.setEnabled(true);
        }
        else{
            jTXDist.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210)));
            jTtamDist.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210)));
            jTForcaDist.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210)));

            jTXDist.setText("");
            jTtamDist.setText("");
            jTForcaDist.setText(" ");

            labelXDist.setEnabled(false);
            labelMXDist.setEnabled(false);

            labelForcaDist.setEnabled(false);
            labelNDist.setEnabled(false);

            labelTDist.setEnabled(false);
            labelMTDist.setEnabled(false);
        }

    }

    public void setVisibleInfoMomento(boolean opcao){

        if(opcao){
            jTXMomento.setEditable(true);
            jTXMomento.setEnabled(true);
            jTXMomento.setBorder(bordaI);

            jTForcaMom.setEditable(true);
            jTForcaMom.setEnabled(true);
            jTForcaMom.setBorder(bordaI);

            labelXMom.setEnabled(true);
            labelMXMom.setEnabled(true);

            labelForcaMom.setEnabled(true);
            labelNMom.setEnabled(true);
        }
        else{
            jTXMomento.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210)));
            jTForcaMom.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210)));

            jTXMomento.setText(" ");
            jTForcaMom.setText(" ");

            labelXMom.setEnabled(false);
            labelMXMom.setEnabled(false);

            labelForcaMom.setEnabled(false);
            labelNMom.setEnabled(false);
        }

    }

    public void setVisibleExibirTela(boolean opcao){

        if(opcao){
           exibeGraficoMF.setEnabled(true);
           exibeGraficoEC.setEnabled(true);
           exibeEsforco.setEnabled(true);
           exibeMomento.setEnabled(true);

           exibeGraficoMF.setSelected(true);
           exibeGraficoEC.setSelected(true);
           exibeEsforco.setSelected(true);
           exibeMomento.setSelected(true);

           //tirar a parte de deformada
           //exibeDeformacao.setSelected(false);
           if(resultSeccao != null){
                graficoDeformada.setEnabled(true);
                exibeDeformada.setEnabled(true);
           }
        }
        else{
           exibeGraficoMF.setEnabled(false);
           exibeGraficoEC.setEnabled(false);
           exibeEsforco.setEnabled(false);
           exibeMomento.setEnabled(false);

           exibeGraficoMF.setSelected(false);
           exibeGraficoEC.setSelected(false);
           exibeEsforco.setSelected(false);
           exibeMomento.setSelected(false);
        }

    }

    public void converteGrafico(){
        pontosFletor.removeAll(pontosFletor);
        pontosCortante.removeAll(pontosCortante);

        pontosDeformada.removeAll(pontosDeformada);

        momentoFletor = diagramas.getMfletorResultante();
        esforcoCortante = diagramas.getFcortanteResultante();
        x = diagramas.getX();




        Point p;
        int indiceA = 0;

//        ArrayList<Point> pontosPositivos = new ArrayList<Point>();
//        ArrayList<Point> pontosNegativos = new ArrayList<Point>();
//        boolean xPositivo = false;
//
//        Momento Fletor
//        for(int i=0; i < momentoFletor.length; i++){
//            double xP = x[i];//x Fletor
//            double y = momentoFletor[i];//y Fletor
//
//            xP = utili.conversaoMPixelX(xP, panelPrincipal1.getWidth());
//
//            p = new Point((int)xP, (int)y);
//            if(y>0){
//                pontosPositivos.add(p);
//                if(i == 0){
//                    xPositivo = true;
//                }
//            }
//            else if(y<0){
//                pontosNegativos.add(p);
//            }
//            else if(y == 0 && xP == 0 && i==0){
//                if(momentoFletor[i+1] < 0){
//                    pontosNegativos.add(p);
//                }
//                else{
//                    pontosPositivos.add(p);
//                }
//            }
//            else{
//                pontosPositivos.add(p);
//            }
//            else{
//                pontosPositivos.add(p);
//                pontosNegativos.add(p);
//            }
//        }
//
//        double yMax = 0;
//        for(int i=0; i < pontosPositivos.size(); i++){
//            if(pontosPositivos.get(i).y >= yMax){
//                yMax = pontosPositivos.get(i).y;
//            }
//        }
//
//        int auxTam = 60;
//        double limiteInferior = (double)(panelPrincipal1.getHeight() - auxTam);
//        double a = 0;
//        if(yMax != 0) {
//            a = (limiteInferior - panelPrincipal1.getyInicio()) / yMax;
//        }
//
//        double b = panelPrincipal1.getyInicio();
//
//        for(int i=0; i < pontosPositivos.size(); i++){
//            pontosPositivos.get(i).y = (int) (pontosPositivos.get(i).y * a + b);
//        }
//
//
//        int yMin = 1000000;
//        for (int i = 0; i < pontosNegativos.size(); i++) {
//            if (pontosNegativos.get(i).y <= yMin) {
//                yMin = pontosNegativos.get(i).y;
//            }
//        }
//
//        double limiteSuperior = 50.0;
//        a = (limiteSuperior - panelPrincipal1.getyInicio())/yMin;
//
//        for(int i=0; i < pontosNegativos.size(); i++){
//            pontosNegativos.get(i).y = (int) (pontosNegativos.get(i).y * a + b);
//        }
//
//        if (xPositivo) {
//            for (int i = 0; i < pontosPositivos.size(); i++) {
//                pontosFletor.add(pontosPositivos.get(i));
//            }
//            int j = 0;
//            for (int i = 0; i < pontosNegativos.size(); i++) {
//                pontosFletor.add(pontosNegativos.get(i));
//            }
//        }
//        else{
//            for (int i = 0; i < pontosNegativos.size(); i++) {
//                pontosFletor.add(pontosNegativos.get(i));
//            }
//            for (int i = 0; i < pontosPositivos.size(); i++) {
//                pontosFletor.add(pontosPositivos.get(i));
//            }
//        }
//
//        pontosPositivos.removeAll(pontosPositivos);
//        pontosNegativos.removeAll(pontosNegativos);
//        xPositivo = false;
//        -------------------------------------------------------------
//
//        Esforço Cortante
//        Momento Fletor
//        for(int i=0; i < esforcoCortante.length; i++){
//            double xP = x[i];//x Fletor
//            double y = esforcoCortante[i];//y Fletor
//
//            xP = utili.conversaoMPixelX(xP, panelPrincipal1.getWidth());
//
//            p = new Point((int)xP, (int)y);
//            if(y>=0){
//                pontosPositivos.add(p);
//                if(i == 0){
//                    xPositivo = true;
//                }
//            }
//            else if(y<0){
//                pontosNegativos.add(p);
//            }
//            else{
//                pontosPositivos.add(p);
//                pontosNegativos.add(p);
//            }
//        }
//
//        yMax = 0;
//        for(int i=0; i < pontosPositivos.size(); i++){
//            if(pontosPositivos.get(i).y >= yMax){
//                yMax = pontosPositivos.get(i).y;
//            }
//        }
//        a = 0;
//        if(yMax != 0) {
//            a = (limiteSuperior - panelPrincipal1.getyInicio()) / yMax;
//        }
//        for(int i=0; i < pontosPositivos.size(); i++){
//            pontosPositivos.get(i).y = (int) (pontosPositivos.get(i).y * a + b);
//        }
//
//        --------
//        yMin = 1000000;
//        for (int i = 0; i < pontosNegativos.size(); i++) {
//            if (pontosNegativos.get(i).y <= yMin) {
//                yMin = pontosNegativos.get(i).y;
//            }
//        }
//
//        a = 0;
//        if(yMin != 0) {
//            a = (limiteInferior - panelPrincipal1.getyInicio()) / yMin;
//        }
//        for(int i=0; i < pontosNegativos.size(); i++){
//            pontosNegativos.get(i).y = (int) (pontosNegativos.get(i).y * a + b);
//        }
//
//
//        if (xPositivo) {
//            for (int i = 0; i < pontosPositivos.size(); i++) {
//                pontosCortante.add(pontosPositivos.get(i));
//            }
//            int j = 0;
//            for (int i = 0; i < pontosNegativos.size(); i++) {
//                pontosCortante.add(pontosNegativos.get(i));
//            }
//        }
//        else{
//            for (int i = 0; i < pontosNegativos.size(); i++) {
//                pontosCortante.add(pontosNegativos.get(i));
//            }
//            for (int i = 0; i < pontosPositivos.size(); i++) {
//                pontosCortante.add(pontosPositivos.get(i));
//            }
//        }


        


        for(int i=0; i < momentoFletor.length; i++){
            double xP = x[i];//x Fletor
            double y = momentoFletor[i];//y Fletor

            xP = utili.conversaoMPixelX(xP, panelPrincipal1.getWidth());
            //y = utili.conversaoMPixelY(y, panelPrincipal1.getHeight());

            p = new Point((int)xP, (int)y);
            pontosFletor.add(p);
        }


        int yMax = 0;
        int yMin = 1000000;
        for(int i=0; i < pontosFletor.size(); i++){
            if(pontosFletor.get(i).y >= yMax){
                yMax = pontosFletor.get(i).y;
                indiceFletor = i;
            }
        }

        for (int i = 0; i < pontosFletor.size(); i++) {
            if (pontosFletor.get(i).y <= yMin) {
                yMin = pontosFletor.get(i).y;
            }
        }


//        int auxTam = 60;
//        double au = (yMax - yMin);
//        double a = (double) ((80)/au);
//        double b = -1*a*yMin;
        double tamanhoD = 80;
        if(yMin != yMax){
            tamanhoD = 80;
        }
        else{
            yMin = 0;
            tamanhoD = (tamanhoD/2)*yMax/10.000;
        }
        double au = (yMax - yMin);
        double a = (double) ((tamanhoD)/au);
        double b = -1*a*yMin;

        for(int i=0; i < pontosFletor.size(); i++){
            pontosFletor.get(i).y = (int) (pontosFletor.get(i).y * a + b);
        }
        double deslocamento = panelPrincipal1.getyInicio() - b;
        System.out.println("Deslocamento: " + deslocamento);
        for(int i=0; i < pontosFletor.size(); i++){
            pontosFletor.get(i).y +=deslocamento;
        }

        //Esforço Cortante
        int count = 0;
        for(int i=0; i < esforcoCortante.length; i++){
            double xP = x[i];//x Fletor
            double y = esforcoCortante[i];//y Fletor

            xP = utili.conversaoMPixelX(xP, panelPrincipal1.getWidth());
            //y*=-1;
            if(y == 0){
                count++;
            }

            p = new Point((int)xP, (int)y);
            pontosCortante.add(p);
        }

        if (count != pontosCortante.size()) {

            yMax = 0;
            yMin = 1000000;
            for (int i = 0; i < pontosCortante.size(); i++) {
                if (pontosCortante.get(i).y >= yMax) {
                    yMax = pontosCortante.get(i).y;
                }
            }

            for (int i = 0; i < pontosCortante.size(); i++) {
                if (pontosCortante.get(i).y <= yMin) {
                    yMin = pontosCortante.get(i).y;
                }
            }

            if (yMin != yMax) {
                tamanhoD = 80;
            } else {
                yMax = 0;
                tamanhoD = (tamanhoD / 2) * yMin / -10.000;
            }
            au = yMin - yMax;
            a = (double) ((tamanhoD) / au);
            b = -1 * a * yMin;


            for (int i = 0; i < pontosCortante.size(); i++) {
                pontosCortante.get(i).y = (int) (pontosCortante.get(i).y * a + b);
            }
            deslocamento = panelPrincipal1.getyInicio() - b;
            System.out.println("Deslocamento: " + deslocamento);
            for (int i = 0; i < pontosCortante.size(); i++) {
                pontosCortante.get(i).y += deslocamento;
            }
        }
        else{
            pontosCortante.removeAll(pontosCortante);
        }

        if (!opcaoGrafico) {

            deformada = diagramas.getDeformadaResultante();
            ArrayList<Double> listY = new ArrayList<Double> ();
            //double fator = 1000000000;
            double fator = 1;
            for (int i = 0; i < deformada.length; i++) {
                double xP = x[i];//x Deformada
                double y = deformada[i]*fator;//y Deformada
                listY.add(y);

                xP = utili.conversaoMPixelX(xP, panelPrincipal1.getWidth());
                //y = utili.conversaoMPixelY(y, panelPrincipal1.getHeight());

                p = new Point((int) xP, (int) y);
                pontosDeformada.add(p);
            }


            double yMax1 = 0;
            double yMin1 = 1000000;
            
            for (int i = 0; i < pontosDeformada.size(); i++) {
                if (listY.get(i) >= yMax1) {
                    //yMax = pontosDeformada.get(i).y;
                    yMax1 = listY.get(i);
                    //indiceFletor = i;
                }
            }

            for (int i = 0; i < pontosDeformada.size(); i++) {
                if (listY.get(i) <= yMin1) {
                    //yMin = pontosDeformada.get(i).y;
                    yMin1 = listY.get(i);
                }
            }
            
//            for (int i = 0; i < pontosDeformada.size(); i++) {
//                if (pontosDeformada.get(i).y >= yMax1) {
//                    //yMax = pontosDeformada.get(i).y;
//                    yMax1 = listY.get(i);
//                    //indiceFletor = i;
//                }
//            }
//
//            for (int i = 0; i < pontosDeformada.size(); i++) {
//                if (pontosDeformada.get(i).y <= yMin1) {
//                    //yMin = pontosDeformada.get(i).y;
//                    yMin1 = listY.get(i);
//                }
//            }


//        int auxTam = 60;
//        double au = (yMax - yMin);
//        double a = (double) ((80)/au);
//        double b = -1*a*yMin;
//          tamanhoD = 80;
//            if (yMin != yMax) {
//                tamanhoD = 80;
//            } else {
//                yMin = 0;
//                tamanhoD = (tamanhoD / 2) * yMax / 10.000;
//            }
//            au = (yMax - yMin);
//            a = (double) ((tamanhoD) / au);
//            b = -1 * a * yMin;
//
//            for (int i = 0; i < pontosDeformada.size(); i++) {
//                pontosDeformada.get(i).y = (int) (pontosDeformada.get(i).y * a + b);
//            }
//            deslocamento = panelPrincipal1.getyInicio() - b;
//            System.out.println("Deslocamento: " + deslocamento);
//            for (int i = 0; i < pontosDeformada.size(); i++) {
//                pontosDeformada.get(i).y += deslocamento;
//            }
            tamanhoD = 80;
            if (yMin1 != yMax1) {
                tamanhoD = 80;
            } else {
                yMin1 = 0;
                tamanhoD = (tamanhoD / 2) * yMax1 / 10.000;
            }
            au = (yMax1 - yMin1);
            a = (double) ((tamanhoD) / au);
            if (engstP && jRDistribuida.isSelected()) {
                if (a < 0) {
                    a = -1 * a;
                }
            }
            b = -1 * a * yMin1;

           
            for (int i = 0; i < pontosDeformada.size(); i++) {
                pontosDeformada.get(i).y = (int) (listY.get(i) * a + b);
            }
            deslocamento = panelPrincipal1.getyInicio() - b;
            System.out.println("Deslocamento: " + deslocamento);
            for (int i = 0; i < pontosDeformada.size(); i++) {
                pontosDeformada.get(i).y += deslocamento;
            }
        }
//
//
//        double sub = pontosCortante.size() - indiceA;
//        double div = 80.0/pontosCortante.size();
//        double auxD = (sub * div);
//        deslocamento = panelPrincipal1.getyInicio() - auxD;
//        System.out.println("Deslocamento: " + deslocamento);
//        for(int i=0; i < pontosCortante.size(); i++){
//            pontosCortante.get(i).y +=deslocamento;
//        }
//        double sub = pontosCortante.size() - indiceFletor;
//        double div = 80.0/pontosCortante.size();
//        double auxD = (sub * div);
//        deslocamento = panelPrincipal1.getyInicio() - auxD;
//        System.out.println("Deslocamento: " + deslocamento);
//        for(int i=0; i < pontosCortante.size(); i++){
//            pontosCortante.get(i).y +=deslocamento;
//        }



//        for(int i=0; i < esforcoCortante.length; i++){
//            double xP = x[i];//x Fletor
//            double y = esforcoCortante[i];//y Fletor
////            if( y < 0){
////                y = utili.conversaoPixelMY(panelPrincipal1.getHeight(), panelPrincipal1.getHeight()) + y;
////            }
//
//            xP = utili.conversaoMPixelX(xP, panelPrincipal1.getWidth());
//            if(jRConcentrada.isSelected() || jRDistribuida.isSelected()){
//                y = utili.conversaoMPixelY(y*-1, panelPrincipal1.getHeight());
//            }
//            else{
//                y = utili.conversaoMPixelY(y*-1, panelPrincipal1.getHeight());
//                y = panelPrincipal1.getHeight() - y;
//                //y = utili.conversaoMPixelY(y, panelPrincipal1.getHeight());
//            }
//
//            p = new Point((int)xP, (int)y);
//            pontosCortante.add(p);
//        }
//
//        yMax = 0;
//        yMin = 100000;
//        for(int i=0; i < pontosCortante.size(); i++){
//            if(pontosCortante.get(i).y < yMin){
//                yMin = pontosCortante.get(i).y;
//                //indiceCortante = i;
//            }
//        }
//        for(int i=0; i < pontosCortante.size(); i++){
//            if(pontosCortante.get(i).y > yMax){
//                yMax = pontosCortante.get(i).y;
//                indiceCortante = i;
//            }
//        }
//
//        //xMax = pontosCortante.get(indiceCortante).x;
//
//
//        au = (yMax - yMin);
//        if(au !=0){
//            a = (double) ((2*auxTam)/au);
//            b = panelPrincipal1.getyInicio() - auxTam - a*yMin;
//            for(int i=0; i < pontosCortante.size(); i++){
//                pontosCortante.get(i).y = (int) (pontosCortante.get(i).y * a + b);
//            }
//        }
//        else{
//            a = 0;
//        }
        

    }

    public ArrayList<Point> getPontosFletor() {
        return pontosFletor;
    }

    public ArrayList<Point> getPontosCortante() {
        return pontosCortante;
    }
    
    public ArrayList<Point> getPontosDeformada() {
        return pontosDeformada;
    }


    public MouseEventosConcentrada getMouseConcentrada() {
        return mouseConcentrada;
    }

    public MouseEventosDistribuida getMouseDistribuida() {
        return mouseDistribuida;
    }

    public MouseEventosMomento getMouseMomento() {
        return mouseMomento;
    }

    public JToggleButton getjTDesenhoViga() {
        return jTDesenhoViga;
    }


    public void setVisibleAnguloMohr(boolean opcao){

        if(opcao){
            jTextFieldAnguloMohr.setEditable(true);
            jTextFieldAnguloMohr.setEnabled(true);
            jTextFieldAnguloMohr.setBorder(bordaI);
        }
        else{
            jTextFieldAnguloMohr.setEnabled(false);
            jTextFieldAnguloMohr.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210)));
            jTextFieldAnguloMohr.setText("");
        }

    }

    //Seccao
    private void carregarFigura() {
        fig = new Figura();
        jPanelFigura = fig;

    }

    private void criaVetorPontos() {
        xs = new int[jCBListaPontos.getItemCount()];
        ys = new int[jCBListaPontos.getItemCount()];
        String temp;
        String t[];
        for (int i = 0; i < xs.length; i++) {
            temp = (String) jCBListaPontos.getItemAt(i);
            t = temp.split(";");
            xs[i] = Integer.parseInt(t[0]);
            ys[i] = Integer.parseInt(t[1]);
        }
    }

    public JCheckBox getExibeDeformada() {
        return exibeDeformada;
    }

    public JTextField getTextFieldXpixel() {
        return textFieldXpixel;
    }

    public JTextField getTextFieldXreal() {
        return textFieldXreal;
    }

    public JTextField getTextFieldYpixel() {
        return textFieldYpixel;
    }

    public JTextField getTextFieldYreal() {
        return textFieldYreal;
    }

    
    
    


    


}
